Go Down

Topic: Use PWM on enable pin of H Bridge for speed control ? (Read 1 time) previous topic - next topic


The topic says it all, can I use PWM on the Enable pin of the H Bridge for speed control of my robots motors?
Is there a tutorial I missed somewhere about this? Could someone post a sample of the program code?

something like this I'm assuming:

#define motor1a 9;
#define motor1b 10;
#define enable1 11;
int speed
void setup ();
   pinMode (motor1a, OUTPUT)
   pinMode (motor1b, OUTPUT);
   pinMode (enable1, OUTPUT);
void loop ();
   digitalWrite(motor1a, HIGH);
   digitalWrite(motor1b, LOW);
   //heres where i'm lost
   USE PWM (enable1, speed) // something like that.


You can use the analogWrite() function where you write "USE PWM".

Here's some sample code for our Rugged Motor Driver which uses full power (i.e., analogWrite(EN1_PIN, 255)) but you can use a number from 0 to 255 to control the power:


The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

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