Pages

Sunday, March 15, 2015

Arduino Day 3

3/10/14: Photocell, LED, and Servo Challenge

After class ended last Friday, we were asked to create a program that incorporated code from the programs we modified previously by Monday. Over the weekend, we came in to work on the program.

Task: to use a Photocell to control LED and Servo

Brooke and I started a bit confused about what we should be using for the program, and how we should set up the breadboard to connect the LED and Servo to the Arduino board. We started browsing the web for possible ideas on how to activate the Photocell, and found commands that connected the Photocell to Servo and LED.

Our original program took ideas from the web, our modified sweep program with the Servo, and our modified knob program with the LED. We were hoping that the LED brightness would dim according to how much the light the Photocell received, and in our first try, it worked! Then...we fumbled around with the wires to attach the Servo to the breadboard, and we lost our original success with the LED lights. We tried rewiring again to fix the program, but even with the correct wiring, we weren't able to control our LED brightness again. However, this program was successful in allowing the Photocell to control the Servo, reversing directions when the Photocell received or did not receive light. We were happy with those results, and modified them in our final code that incorporated the structure that Amy had set up for us.
In this program, we kept track of how much light the Photocell was receiving by having the program print out variations of "very bright", "bright", "dim", "dark", and "light". By keeping track of the light, we would be able to tell if the Photocell actually controlled the LED and Servo. The Servo was commanded to read the amount of "light" received by the Photocell and translate that amount to degrees at which it should position itself. The LED was told simply to shut off if it was "dark" to "dimly lit" phase, and to turn on if it was "bright" to "light".

In class on Tuesday, we presented our project to another group, and got started with another project that we will be using Arduino to control: the sciborg. We spent class time soldering wires to create a battery holder and using screws and screwdrivers to lock certain components, such as the Arduino board, in place. Over this week, we will be looking at new programs through Bricktronics examples to run our sciborg.












No comments:

Post a Comment