Weekly Journal #2 (Alexandra E. Morton)

This last week we worked on understanding and using Digital I/O — that is, the setting up and using input and output components and our Arduinos to program and perform simple tasks. After going over the different components we would be using for programming earlier in the week in ass a class, we put this into practice by setting up 5 LEDs and two buttons on a breadboard and attempting to accomplish 3  Digital I/O Exercises.

Exercise 1 had us making the LEDs blink twice a second, unless the button was being held down (at which point they should blink 10 times per second). This used const ints [to keep track of the LEDs and use them in for(){} loops, pinMode()s [INPUTs and OUTPUTs], digitalRead(), digitalWrite()s, HIGHs and LOWs, for(){} loops, if {} else{} statements, and delay()s. Along with a bit of math to get the right number of blinks.

Ex 1 Slow/Fast:

giphy

Exercise 2 had us making the LEDs blink twice a second at the beginning, with the rate of blinks per second increasing every time the button was pressed. This used, along with the previously mentioned, int [one to update  the amount to decrease from the original delay time, and one to update the current delay speed], and Bouncer [Bounce debouncer = Bounce(), debouncer.attach(), and debouncer.update() and debouncer.rose() instead of digitalRead()] — which hopefully made the program run smoother than it otherwise would have.

Ex 2 Faster/Faster: Video

Lastly, we had Exercise 3 had us making a light travel across the LEDs: one button making the light go one way, along with a new button to make them go the other way – with the condition that nothing should happen while any LED was still lit, and the button should not work at the same time. This used everything previously mentioned except the Bouncer [Bounce debouncer = Bounce(), debouncer.attach(), and debouncer.update() and debouncer.rose() instead of digitalRead()], with the addition another pinMode()s [INPUT] and digitalRead() for the new button.

Ex 3 Back/Forth:

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