Starship Interface! Getting to know the programming side of Arduino. (Pins, time delay)
This project had us building a LED array that would act as our starship interface! This interface contained 2 red LED's and 1 green one, that when hooked up and programmed right, would act as a sort of "countdown timer" for the starship launch.
The setup had us connecting the three LED's to the 3, 4, 5 pin slots, with the button being connected to the second pin slot. They were also connected to the positive and negative wire lines with resistors. The assignment also made me use this pre-cutout piece of cardboard that would sit atop the LED's and the turnon switch.
Honestly the most difficult part of this project was bending the cardboard piece and the wires so they would all sit together without slipping off. I wish this project was better designed for this cardboard piece, as it kinda seems like an after thought in the mind of the book writers/engineers. We had to do our first bit of programming for this project, utilizing both the pre-given setup and loop functions.
In the setup function we set the INPUT/OUTPUT states of the 2 - 5 pins, with 2 being an input (since it is a button) and 3 - 5 being an output (since they are the LED array). In the loop array we kept checked the switchState of the button input (2 pin). If the button isn't pushed, then the green LED will stay continuously on, as shown in the GIF below. But if the button is pushed, then the program will make the red LED's blink downward using the delay function, while switching their respective states to get the job done.
Comments
Post a Comment