Project 2 State Machines, Switch/Case, and For () Loops

For this project I utilized my previous configuration and implemented for () loops, switch/case, and a state machine to meet the requirements of this project. My previous code was all about 5 inputs that would turn on a light if pressed in the right order as well as an analog reading from the photo resistor. I proceeded to remove one of the 5 buttons as well as the photo resistor and work from the left over 4 inputs A-D. Since I am new to Arduino coding I did a very simple configuration in which each of the 4 buttons would make the LED behave differently. InputA would make the LED flash rapidly, InputB would make the LED pulse slower, InputC would make the LED fade from off to on, and InputC would make the LED fade to off. I practiced by trying to figure out the statement to fade on and once figured out reversed that to have it fade off and then copy pasted that into my for()loop. The rest of the commands were pretty simple.

Link to video-


Leave a Reply