Tuesday, September 29, 2009

Solar Tracker

Our team's solar tracker used 4 LDRs and 2 servos to track a light source. The arduino and bread board is held in a box which is attached to the YZ axis servo.








Heres the code that we used-

void loop()
{
for(posY = 0; posY <>
{ // in steps of 1 degree
Yaxis.write(posY); // tell servo to go to posYition in variable 'posY'
delay(15); // waits 15ms for the servo to reach the posYition
}
for(posY = 46; posY <>
{ // in steps of 1 degree
Yaxis.write(posY); // tell servo to go to posYition in variable 'posY'
delay(15); // waits 15ms for the servo to reach the posYition
}
for(posY = 136; posY <>
{ // in steps of 1 degree
Yaxis.write(posY); // tell servo to go to posYition in variable 'posY'
delay(15); // waits 15ms for the servo to reach the posYition
}
for(posY = 180; posY>=1; posY-=1) // goes from 180 degrees to 0 degrees
{
Yaxis.write(posY); // tell servo to go to posYition in variable 'posY'
delay(15); // waits 15ms for the servo to reach the posYition
}
}








































No comments:

Post a Comment