Author Topic: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot  (Read 2460 times)

0 Members and 1 Guest are viewing this topic.

Offline logicguyTopic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
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.

Offline logicguyTopic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot
« Reply #1 on: February 21, 2010, 06:11:23 PM »
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:

Code: [Select]
/*********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:



Can someone with a modified servo tell me if that is the correct orientation ?

Thanks.

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot
« Reply #2 on: February 21, 2010, 06:19:57 PM »
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.

Offline logicguyTopic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot
« Reply #3 on: February 21, 2010, 06:57:10 PM »
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 ?

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot
« Reply #4 on: February 21, 2010, 07:24:29 PM »
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.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 110
Re: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot
« Reply #5 on: February 21, 2010, 09:23:53 PM »
... 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.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline logicguyTopic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Hold servo .hex doesn't work on ATMega168 (need source code) - 50 $ robot
« Reply #6 on: February 22, 2010, 11:35:18 PM »
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.

 


Get Your Ad Here

data_list