Society of Robots - Robot Forum
Software => Software => Topic started by: logicguy on February 20, 2010, 09:44:19 PM
-
Hello!
I'm currently using an ATMega168 for the 50 $ robot, but the hex file that is needed to modify the servo doesn't work on other type of microcontollers, since it's compiled for ATMega8. Can someone help me with the code that is needed to get my servo to rotate to 0 degrees so that I can later modify it ?
Thank you in advance.
-
I found a post that is written by the Admin, but I'm not sure if it rotates my servo exactly to 0 degrees. I modified it to fit the variables that are written for the photovore source code:
/*********ADD YOUR CODE BELOW THIS LINE **********/
LED_off();//turn LED on
while(1)
{
servo_left(30);
delay_cycles(20);
}
/*********ADD YOUR CODE ABOVE THIS LINE **********/
Do those commands rotate my servo to exactly 0 degrees ? I have tested it and it works, but this is what is happening when I run the program:
(http://img99.imageshack.us/img99/8371/dsc00149.th.jpg) (http://img99.imageshack.us/i/dsc00149.jpg/)
Can someone with a modified servo tell me if that is the correct orientation ?
Thanks.
-
It is correct if everything is working correctly.
The servo horn will be in different positions for different servos, since they are just screwed on arbitrarily from the factory.
-
Thank you for your response.
You are right, I checked the other servo that I bought, and it changes to a different position with a different max/min orientation.
You are also saying that those values will orient my servo to 0 degrees, but that's not important, the importance is that it's rotating during the modification ?
-
No, it will orient your servo to 0 degrees, and so during modification you should not spin the gears, so that the pot remains at that 0 degree location.
I just meant that when the manufacturer builds the servos, they do not put the servo horn at a specific degree angle, they just slap it on there at any position and screw it in.
-
... so if you want the servos to look the same then unscrew the 'white circle', run the program to center it, and then screw the 'white circle' back on in any position you like.
-
Thank you for your suggestions.
I'm about to modify my servo, so are you sure that the code will put my servo to 0 degrees ? Admin says that I must modify the "30" value until the servo is centered which worries me a little, since I don't understand why I should modify the 30 value when it should center it automatically.
I also ordered an ATMega8 just to be sure if I screw something up with my first servo so that I can run the .hex file and possibly modify it successfully.
This is an urgent notice, I will present this robot next week.