Aadvik Navad YT
Published

Spaceship Interface

This is how to make Arduino Project 2.

BeginnerFull instructions provided45 minutes267
Spaceship Interface

Things used in this project

Hardware components

Through Hole Resistor, 10 ohm
Through Hole Resistor, 10 ohm
×1
Resistor 220 ohm
Resistor 220 ohm
×2
LED (generic)
LED (generic)
×3
Jumper wires (generic)
Jumper wires (generic)
×6
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×1

Hand tools and fabrication machines

Breadboard, 270 Pin
Breadboard, 270 Pin

Story

Read more

Code

Spaceship_Interface Code

C/C++
This is the code. Please look at the video for what each line and function does.
int switchState = 0;
void setup() {
  // put your setup code here, to run once:/
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(2, INPUT);
 }

void loop() {
  // put your main code here, to run repeatedly:
  switchState = digitalRead(2);

  if (switchState == LOW)
  {
    digitalWrite(5, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  }
  else
  {
    digitalWrite(5, LOW);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);

    delay(500);
    // toggle the LEDs
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    delay(500);
  }



}

Credits

Aadvik Navad YT
2 projects • 1 follower
I'm 11yrs old and love to program and do projects on Arduino and Python. My projects mainly consist of Arduino projects.
Thanks to Suraj Gajendra.

Comments