go away spammer

Author Topic: $50 robot, Servo modification  (Read 3518 times)

0 Members and 1 Guest are viewing this topic.

Offline violinkidTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
$50 robot, Servo modification
« on: July 17, 2009, 12:06:25 AM »
Hi, I'm new to this forum. I was reading the tutorial on how to modify servos for $50 robots and was confused on the part where i have to put in some code to hold it at 0. Do I have to finish making the cpu of the robot before I can modify the servos? I didn't really understand the directions in the tutorial. Thanks   ???

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: $50 robot, Servo modification
« Reply #1 on: July 17, 2009, 12:10:49 AM »
yes, you must complete the board to modify the servos.
the board is what controls them, and makes them go to the right spot.
Howdy

Offline psic

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: $50 robot, Servo modification
« Reply #2 on: August 22, 2009, 06:32:35 PM »
Hello, I hope you don't mind me adding my question here, since it's a bit of a follow-up...

I'm also following the 50-dollar robot tutorial, I've already completed the board, which works fine (the code for centering the servos worked perfectly). I also modified the servos, and now I'd like to test them out with a PWM signal.

The problem is, I'm not sure how exactly to do that. I've been reading up on PWM but I'm not sure how exactly to use pins PD0 and/or PD1 as output for the PWM (since my 2 servos are hooked up to these 2 pins), as all of the tutorials I've come across use port B and the timer that it is associated with (if I understand correctly).

I realise this is somewhere in the final code for the 50 dollar robot, but I can't find it (still too new to all this).

Any help would be appreciated :)

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: $50 robot, Servo modification
« Reply #3 on: August 22, 2009, 06:38:54 PM »
im not an expert in programming but those pins are not pwm pins so i do not know if this is possible...
pins 5, 11, 12, 15 and 16 are all pwm pins so you can try hooking the servos up to them...
do you need any help with the code for pwm?
Howdy

Offline psic

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: $50 robot, Servo modification
« Reply #4 on: August 22, 2009, 06:53:23 PM »
Well, it has me a bit confused as well, since these are the pins which are used to control the servos in the 50 dollar tutorial here: http://www.societyofrobots.com/step_by_step_robot_step3C.shtml. Quote: "And if you haven't figured it out yet already, plug your servos into PD0 and PD1 (pin 2 and pin 3)."

I know I could try using PortB, but I've already got the entire board soldered.

As for the code for PWM, I was planning on trying out the code here: http://www.societyofrobots.com/member_tutorials/node/234 (if I understand correctly, I'd add
Code: [Select]
  DDRB |= (1<<5); to set pin PB5 as output?)

 


Get Your Ad Here