Go Down

Topic: Programming Scrolling Question (Read 2208 times) previous topic - next topic


How are you powering the motors?  One common mistake is to power them from the Arduino board.  They'll need their own power supply or battery pack (always connect the grounds together).

It sounds like you might be drawing too much power when you put load on the motors.  This makes the Arduino reboot.
There are 10 types of people in the world, those who understand binary, and those that don't.


Next question (low batteries was the answer to the last one sorry!)

my only thing is that the code is correct but the system doesnt follow it perfectly.  the burst is too high on the wheels (they accelerate too fast too quickly in a way that when it supposed to move straight, it just doesnt...)  how do i lower the speed of the wheels?

object: make motors into a square
current code:

Code: [Select]
int motorPin1 = 6;
int motorPin2 = 11;
void setup(){
pinMode (motorPin1, OUTPUT);
pinMode (motorPin2, OUTPUT);
void loop(){
  delay (700);
  digitalWrite (motorPin1, HIGH);
  digitalWrite (motorPin2, HIGH);
  delay (100);
  digitalWrite (motorPin1, LOW);
digitalWrite (motorPin2, LOW);

digitalWrite (motorPin1, LOW);
digitalWrite (motorPin2, HIGH);
digitalWrite (motorPin1, LOW);
digitalWrite (motorPin2, LOW);


Nov 26, 2012, 04:03 am Last Edit: Nov 26, 2012, 04:06 am by patduino Reason: 1
Without knowing how your motors are wired up, I really can't say.  I'm curious, How are they configured, how are you controlling them (outputs driving transistors? a shield?), and how are you powering them (separate batteries?)?

From looking at the code, you are turning them on and off digitally -- full speed on / complete stop.

Alternatively, you can drive them using pulse-width modulation (PWM) and output a lower "voltage" to slow them down.  If you are not sure how, do a quick google on "Arduino PWM" to get what you need.  Its fairly easy to do.

There are 10 types of people in the world, those who understand binary, and those that don't.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131