Thursday, April 2, 2015

Arduino Day 3

Photocell

One of our assignments was to program a photocell, which senses the amount of light it is exposed to and displays whether it is "Dark", "Dim", "Light", "Bright" or "Very Bright". The original program is shown below. 



Our job was to take this original program and modify it so that a servos motor moves and an LED light blinks in accordance to the reading of the photocell. 

Using the setup for the servos motor and LED from previous Arduino programs, we incorporated the two into the program and connected them to the arduino board.


We then incorporated a series of else if statements into the loop so that the motor would spin more quickly as the photocell senses more light. This was done by increasing the size of the steps that the servos takes. The LED was also programmed to blink more quickly as the photocell sense more light using the different delays.


















No comments:

Post a Comment