controlling a dc motor with an arduino uno


Posted on Feb 6, 2014

Control a small DC motor through this H-bridge with an Arduino Uno, but I have never programmed one of these controllers before. I need the motor to rotate in different directions when I press left and right on a keyboard. So far I have this code: // Right Motor /* Adjust these values for your servo and setup, if necessary */ int re


controlling a dc motor with an arduino uno
Click here to download the full size of the above Circuit.

sistor1 = 3; int resistor2 = 5; int resistor3 = 6; int resistor4 = 10; int moveServo; void setup() { Serial. begin(9600); pinMode(resistor1, OUTPUT); // Set servo pin as an output pin pinMode(resistor2, OUTPUT); pinMode(resistor3, OUTPUT); pinMode(resistor4, OUTPUT); } void loop() { // Wait for serial input if (Serial. available() > 0) { // Read the incoming byte: moveServo = Serial. read(); // ASCII left = 37, up = 38, right = 39, down = 40 if (moveServo = 37) { digitalWrite(resistor4, HIGH); digitalWrite(resistor1, HIGH); } }




Leave Comment

characters left:

New Circuits

.

 


Popular Circuits

12 Volt 20 Amp Solar Charge Controller
Wireless Ir Security System
555 How can I make a 15 minute egg timer circuit
battery charger circuit
Quiz Circuit PCB
HD44780 16x2 Char LCD Interfacing with microcontroller
reading electricity meter ir impulses
The STA013 MP3 Decoder Chip
Mods and Odds
TDA2030 8w Amplifier



Top