This week, the task was to have the board respond to an input. I started by using my board from the previous week, and my goal was to get the board to respond to the button input.
This week, the task was to have the board respond to an input. I started by using my board from the previous week, and my goal was to get the board to respond to the button input.
With some helpful code I was able to configure the changes in the #DEFINE section to make sure I was referencing the correct pins.
To test, the button here responds to press.
I decided to go a little further and try to get the button clicks to vary by the blink rate. This is where things didn't go too well. The first thing I noticed was that the time delay function doesn't let you declare a parameter in the function itself. To get around this, I declared 3 separate delay functions (I could also have done a loop)
Next, I set up a counter to track each time the button got pressed and to add an additional number to the counter.
For some reason, the code didn't work as I expected. It didn't seem like the button was registering clicks to the counter and entering the different if statements. I was a bit crunched on time this week so wasn't able to troubleshoot.
Since I am creating a lamp for my final, I tested out capacitive touch to see how it works. There are two types of capacitance: self capacitance and mutual capacitance.
Self capacitance was pretty easy to set up and I got readings from serial and saw how the numbers changed. I'll also look more into mutual capacitance for the lamp, which has less noise.