Weekly Journal 2 -(Witt Teem) – Digital I/O

For this weeks lab, my partner Bryce Wiseman and I were instructed to create 3 different circuits using LED’s and Push-buttons in order to create various effects. This exercise was meant to teach us about the concept of digital inputs and outputs in Arduino. For these sketches we were told that we were allowed to use the Delay function and that we should attempt to use the Bounce Library.

The first challenge was to create a sketch that made our row of 5 LED’s blink at 2 times per second and once the button is pushed, to increase the blinking speed. This was a pretty simple to create. We simply declared our LED’s (using an array) as Outputs and our button as an Input. Then, in our loop function we simply stated that if the button-state was High, then the LED’s would blink with one delay, and when it was Low it would bling with less delay.

ex1-com-video-to-gif

The Second challenge was to make the LED’s blink faster every time the the button was pressed. For this sketch we only had to alter our code from the last sketch. We added a variable for the delay and created a Blink function. Once we implemented this, we just had to create a for loop that stated if the button-state is High, to multiply the value of the delay variable by 0.7 each time the button is pressed. We attempted to use the deBouncer in this sketch, but we could not implement it correctly and were able to get the same effect without it.

ex2-com-video-to-gif

The third challenge was the most frustrating. We wired up a second button (which we had a lot more trouble with than we should have) and had to make the lights “move” from one direction to another depending on the button that is pressed. We at first attempted to use finite state machines in order to make it work, but that failed. We eventually got it to work using a series of for loops, but even then it had a couple of issues. At  one point, if you tapped anything but the button it would activate the left light.ex3-com-video-to-gif

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s