I am trying to make an rc car go forward and stop with arduino code.
This is my code. I can put a picture of the car, if needed. The code verified in the software, but when I uploaded it, nothing happened
void setup()
{
/*
I'm going to set the small RC motors as pins
I'm wondering if I have to set them as motors
*/
pinMode(7, OUTPUT);
pinMode(12, OUTPUT);
}
void loop()
{
//All I'm going for is it to move forward and stop
digitalWrite(7, HIGH);
digitalWrite(12, HIGH);
delay(500);
digitalWrite(7, LOW);
digitalWrite(12, LOW);
}
What you have there produces a 1 Hz square wave on pins 7 and 12. In other words, a pulsed voltage at the pins. If you wanted it to happen only once, you should have put the writes in setup().
If you connect most motors directly to a pin, it will not run, and can burn out the Arduino. Please post a schematic of your circuit. More details about the motors would be helpful.
How do the controls of the car work?
Are you sure that just applying a high signal to them will do the job?
If you apply VCC directly (no arduino)to the control pin of the motor does it spin?
I'm going to set the small RC motors as pins
I'm wondering if I have to set them as motors
What do you mean by this comment ?
I don't have a schemetic. I do have a picture of the wiring. It is all disconected now. I've been told that I should probably solder it
UKHeliBob:
I'm going to set the small RC motors as pins
I'm wondering if I have to set them as motors
What do you mean by this comment ?
I meant that I was connecting the motor wires to the digital pins
I meant that I was connecting the motor wires to the digital pins
When the new Arduino you'll need arrives, make sure you don't connect motors to the pins.
yeah, look up on how to connect a motor to an arduino. You never connect it directly to an arduino. A motor creates lots of electrical noise.
And you usually want PWM pins to control speed.
If you are using just one motor, then only one pin needs to be HIGH at a time, not both.
elan22:
How do the controls of the car work?
Are you sure that just applying a high signal to them will do the job?
If you apply VCC directly (no arduino)to the control pin of the motor does it spin?
It is a standard 8-directional rc car
AWOL:
When the new Arduino you'll need arrives, make sure you don't connect motors to the pins.
The wires were unsoldered. So, when I showed it to some people they said that The signal wasn't sent in the first place. Lucky me, right?
mistergreen:
yeah, look up on how to connect a motor to an arduino. You never connect it directly to an arduino. A motor creates lots of electrical noise.
And you usually want PWM pins to control speed.
Overview | Arduino Lesson 13. DC Motors | Adafruit Learning System
Thanks. Looks like I need to pick up a few new parts