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:

Related Circuits

  • New Circuits

    .

     


    Popular Circuits

    Guitar phaser effect
    555 LED flasher II
    The Design of Car Audio Power Amplifier
    telephone dtmf remote control
    General-Purpose Alarm
    GigaHertz Signal Detector Circuit
    Utah T1-Rate Modem
    Henry Radio 5K Classic Blower Modifications
    Door Knob Touch Alarm



    Top