Friday, March 4, 2016

Arduino Introduction Part II

For day 2 of Arduino Jennifer and I first started looking at our pattern with no delay code and board. Amy said that our board was all wrong since each LED did not have its own resistor. Then Jennifer realized that the LEDs were not behaving the way we thought our code told them to. So we first fixed our breadboard so that each LED had its own resistor and removed all the wires from the potentiometer challenge. We then played around with our code and found that we needed to make a new last time per if statement for each LED so that the LEDs would turn on and off exactly the way we wanted them too. We made it so that the the green LED would turn on and off in intervals of 1 second, the red LED would be in intervals of 3 seconds, and the blue LED would be in intervals of 5 seconds.




Challenge #5: Use a photocell to change an LED
In this challenge, we first learned about how a photocell is a resistor that takes in the amount of light in its surroundings and changes the amount of resistance depending on how much light is sensed. Using the line Serial.print() we were able to translate the number the photocell took in to a description of how bright it was. We then used the photocell to turn on and off an LED. We made it so that when the photocell thought it was "dim" (200 < value < 400) the LED would turn on and if the light value was not within that range, the LED would stay off.






Challenge #6 Use a button
In this challenge we learned how to use a button to turn on and off an LED. The LED only turns on when the button is pressed because when the button is pressed the circuit is closed and electrons are able to flow through it but when the button is not pressed, the circuit is not complete and so the LED does not turn on.





Challenge # 7 Use a Servo motor



Sweep:
The disk on the Servo continuously moves back and forth between a specified angle range. We put it to 90 degrees to 90 degrees.





Knob:
The disk rotates between 60 and 120 degrees when the potentiometer is turned from one side to the other.



Reflection:
The most difficult and frustrating challenge was fixing the pattern with no delay code. It took us a really long time to understand exactly what was going on but it was very satisfying when we were finally able to fix it. The most enjoyable part of the last challenges was controlling the LED using the photocell and button.

1 comment: