Week 12, Imput Devices
As I mentioned on output devices, I will just be covering the coding side of the device I made in output devices.
So, with the way that I did the LEDs, I would need to simultaneously activate 3 different pins at the same time and that isn't too hard.
The idea was simple, I wanted to make a device that would light up really bright for a certain amount of time after a button was pressed. (I explained most of it in week 10)
I have the flash put on a timer that would wait 2 and a ½ seconds, have one of the rows flash once after a second 3 times, then turn on fully for another 2 ½ seconds and then finally turn off.
At first I used an altered version of my code (as seen above) that I used for the relay on my final project but then I started to run into some problems because I wanted to have the lights flash once quicly to indicate that the button was pressed and the input was registered. But that didn't work, I didn't know why it was failing but I think it had to do with the fact that there was a variable in it. I don't know why the variable messed it up but worked when I took it out.
Here's the updated code. The first part of the loop code part reads if the button pin detects anything, if it does that would mean that the button was pressed and if it was, then it goes to the next part of the code, the delay 2 ½ delay timer, then the giant block of code after is just the flash 3 times part. Thinking about it now, I probably could have done a while loop and had a countdown but I didn't think about it then so whoops. After that, it's the part that lights up the LEDs for 2 ½ seconds then turns off.
Here's how it looks in action