Stupid Pet Trick

For this assignment, I wanted to create a circuit where pressing a button a certain way would result in a certain color of light emitting from the 3-color LED. This was another adapted attempt of the same project from the book that I tried last week. I wanted to make it so that the light in would be shine blue constantly and pressing the button would result in either a red or green color emitting from the light. The red would be the ‘wrong’ sequence of button presses and the green would be the correct sequence. I thought that this idea was simple and possible, but I really didn’t know how to achieve it.

I started by setting up the breadboard similar to that of the one from the project in the book. I added the button and tried to remember exactly what we did the last class when we used the button.

I couldn’t remember and found a tutorial online that could help guide me. After then, I tried to figure out how to make the red or green light shine when the button was pressed in different ways. After running my idea by a friend, she said that timing things was tricky, so I modified my idea to simplify it a bit. I decided that holding down the button for a certain time should be easier to program than than a certain sequence of presses.

I looked online for a reference and tried to adjust some code to fit my idea for the project. In reality, I had no idea what I was doing and was a bit unclear of which things I needed to change or be mindful of to make the project work the way I wanted it to. At one point, I pressed the button and the green light shone, but then remained on for as long as the arduino was connected to power. I wasn’t able to turn it off by pressing the button or to make the light shine red or blue again.

Here’s my gitHub code.
And here’s the bit I soldered.


Leave a Reply