Our team did a great job in class time. We designed such a system (verson 1.0)that works accurately in a 2D plane with the time constraint is 1 hour! Then in the following week we refined the design via verson 1.5 to verson 2.0.
In-class prototype:version 1.0
One week product: version 2.0:
In this project, I learned that, the design process is more accurately describled as Rapid Prototyping->Tesing->Reprototype->Trouble shooting, rather than simplely Design->Final Product. Besides trouble shooting again and again, re-design the big picture is sometimes necessary, although kind of painful.
But I like the people in our team. They are nice to work with and willing to help. They have nice idea but not force you to accept.
The code we are using: one servo controls the XY motion and the one controls the ZX(or ZY depending on how the coordinate system is defined.)
4 LDRs comparing their values so than to decide which direction to move to. One comparision is done in one loop.
A fuction to stop reading/processing signal when the servo rotates to one end is introduced .
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