Author Topic: Programming question...  (Read 1986 times)

0 Members and 1 Guest are viewing this topic.

Offline Gordo4444Topic starter

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 0
Programming question...
« on: February 12, 2008, 09:37:52 PM »
So I was reading the C#source code for the 50$ dolalr robot and I saw this.


      if   (sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
         {
         servo_left(44);
         servo_right(44);
         }
It detects weather there is more light on the left side or the right side of the robot. Then it turns accordingly. My question is this. What if I'm not using a servo? Im going to be using 2 DC motors. Would it be..

      if  (sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
         {
         DC_left(44);
         DC_right(44);
         }

...? Im confused, How can I find the c# source codes for things im using, such as LED's DC motors and such, Is it all the same? What?! I don't know!
Amy: Spirit! Kif, that's the pony I always wanted but my parents said I had too many ponies already.

Kif: Yes, I programmed it in for you. Four million lines of BASIC!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Programming question...
« Reply #1 on: February 12, 2008, 09:57:30 PM »
You will need additional hardware, such as an ESC (no code change) or a motor driver (read datasheet of the driver to determine what code you need).

Servos already have a built in ESC, but your motors don't, so you need to add it yourself for them to work.

(google around to learn more)

oh, and its just C, not C# (a different programming language, pronounced 'C sharp')

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Programming question...
« Reply #2 on: February 12, 2008, 09:58:44 PM »
you need a motor driver for motors , and then the code would have to control that

I am curious if the PWM generated by the 50 dollar robot could control a PWM driven driver without any modification


Anyway, why aren't you using servos?

LEDs are digital outputs ,so search for C source code for that
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Gordo4444Topic starter

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 0
Re: Programming question...
« Reply #3 on: February 12, 2008, 10:00:19 PM »
My mistake. I thought I saw someone saying the 50$ robot was written in c#. Sorry. Someone told me I should use DC motors instead of servos. Im guessing I shouldnt listen to the. So I'm looking around for cheap servos.
Amy: Spirit! Kif, that's the pony I always wanted but my parents said I had too many ponies already.

Kif: Yes, I programmed it in for you. Four million lines of BASIC!

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Programming question...
« Reply #4 on: February 12, 2008, 10:03:11 PM »
My mistake. I thought I saw someone saying the 50$ robot was written in c#. Sorry. Someone told me I should use DC motors instead of servos. Im guessing I shouldnt listen to the. So I'm looking around for cheap servos.

servocity.com is good , and they give you some little candies with your order , and very fast shipping too!
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Programming question...
« Reply #5 on: February 12, 2008, 10:04:18 PM »
Quote
I am curious if the PWM generated by the 50 dollar robot could control a PWM driven driver without any modification
yeap it can, however its far from optimal - a hardware solution is better.

Cheap servos, the HS-311, can be found for $8.99 in many locations online.

 


Get Your Ad Here

data_list