Arduino Spaceship Interface
by A13xTheAwkward in Circuits > Electronics
3474 Views, 2 Favorites, 0 Comments
Arduino Spaceship Interface
Hi Instructable community,
This time I've made one of the simplest projects to complete with an Arduino Uno: a spaceship circuit. It is so-called because it is the type of programming and circuitry that would be used in early sci-fi TV shows and movies to emulate a "button-flashing" effect that was supposed to show that a rocket ship was performing correctly. There are plenty of resources online to do this project, but hopefully posting it to Instructables will help more people get interested in experimenting with an Arduino.
Materials:
- Arduino Uno Board (starter kit preferred)
- Breadboard
- Circuit connections shown in diagram, including: jumper wires, resistors, LED's, and a button
- Computer with Arduino coding program installed
Build the Module
First, make sure your Arduino is disconnected from the power source. Then, follow these steps to connect all the components of the circuit:
- Wire the breadboard to the Arduino's 5V (positive) and ground (negative) connections.
- Place the two red LED's in slot "e" on the breadboard, somewhat high up on the board, with the green LED in the same slot below them.
- Attach the cathode of each LED to the ground through a 220 ohm resistor.
- Connect the anode of the green LED to digital pin 3 on the Arduino, and do the same for the red LED's into pins 4 and 5.
- Place the button switch below the LED's on the breadboard bridging slots "e" and "f." Attach the higher side to the power, and the lower side to digital pin 2. To the same side, add a 10 kiloohm resistor to the ground. (This resistor causes a "LOW" reading when the button is not pressed.)
Code the Project
Feel free to use the above image and copy-paste the code into your project. If it is difficult to see, follow this link and get the code from GitHub: https://gist.github.com/fjukstad/718203f2f292c4b90106.
Several things to note are that you can change "switchState == LOW" to "switchState == HIGH" in order to switch the behavior of the module: it will blink when unpressed and remain solid when pressed. The other thing to note is that you can change the value of the "delay" statements to adjust how fast the red LED's blink when the button is pressed.
Upload the Code and Play With Your Interface
Connect the Arduino to the computer and upload the code; hopefully, everything works! If not, check your wire connections and make sure all of the code is written correctly. Fix any errors and re-upload.
The green LED should be lit up solidly. Press and hold the button, and the red LED's should blink alternatively to each other! You can make a cover for the button and LED's to say whatever you want, and to hide the wires if you would like. I hope you had fun with this project!