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

Car Light Dimmer 12 Volt
Logic Probe
Programmable Zener
Simple Fm Transmitter Circuit
3-30V 3A Adjustable Regulated DC Power Supply
Interface a HD44780 Character LCD with a PIC Microcontroller
Doorbell Warning Switch
make this solar powered fence charger
ceiling fan regulator motor speed
Q Meter
electronic dice schematics
car burglar alarm timer
Clap Switch Circuit using NE555 timer IC
load switches with zero power MOSFETs
STK6327A application circuit



Top