Finally another chance to spend some time learning my new Freetronics Eleven (aka. Arduino). Some of the basics are starting to sink in, the project guide that came with the kit is actually quite good at explaining the reasons why certain things must be done for both hardware and software. The projects pictured above are:
- Project #4: using a light sensor to dim an LED.
- Project #6: controlling a servo.
- Project #6 Customised: adding an LED that turns on when the servo spins in one direction, and off in the other.
Again not the most exciting projects, but at the moment it’s all about making sense of this ‘new world.’ I have included the code for the custom project #6 if you want to build it yourself.
int led = 13; int delaytime=5; int angle=0; #include <Servo.h> Servo myservo; void setup() { myservo.attach(11); pinMode(led, OUTPUT); } void loop() { while (angle <=180) { myservo.write(angle); delay(delaytime); angle = angle + 1; digitalWrite(led, HIGH); } while (angle > 0) { myservo.write(angle); delay(delaytime); angle = angle - 1; digitalWrite(led, LOW); } }
Happy hacking!
– Posted by James Novak
Would be great to see some videos of these!
LikeLike
I’d love to, just waiting until I build something a little more interesting to watch than blinking LED’s! Stay tuned…
LikeLike