Society of Robots - Robot Forum
Software => Software => Topic started by: Gordo4444 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!
-
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')
-
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
-
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.
-
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!
-
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.