Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
IN1 = Logic input control of OUT1 (i.e., IN1 logic HIGH = OUT1 HIGH)IN2 = Logic input control of OUT2 (i.e., IN2 logic HIGH = OUT2 HIGH)EN = Enable control of device (i.e., EN logic HIGH = full operation, EN logic LOW = Sleep Mode)OUT1, OUT2 = Output 1 and Output 2 of H-BridgeD2 = Active LOW input used to simultaneously tri-state disable both H-Bridge outputs. When D2 is Logic LOW, both outputs are tri-stated.D1 = Active HIGH input used to simultaneously tri-state disable both H-Bridge outputs. When D1 is Logic HIGH, both outputs are tri-stated.
LOGIC INPUT CONTROL AND DISABLE (IN1, IN2, D1, AND D2):These pins are input control pins used to control the outputs. These pins are 5.0 V CMOS-compatible inputs with hysteresis. The IN1 and IN2 independently control OUT1 and OUT2, respectively. D1 and D2 are complementary inputs used to tri-state disable the H-Bridge outputs. When either D1 or D2 is SET (D1 = logic HIGH or D2 = logic LOW) in the disable state, outputs OUT1 and OUT2 are both tri-state disabled; however, the rest of the circuitry is fully operational and the supply IQ (standby) current is reduced to a few milliamperes.
int motor1Input1 = 4 ; // Motor1 inputs connected to pin 4 & 2int motor1Input2 = 2;int motor1Pwm= 9; // Motor1 PWM pinint motor2Input1= 7; // Motor2 inputs connected to pin 7 & 5int motor2Input2= 5;int motor2Pwm= 11; // Motor2 PWM pinint ledPin = 13; // LED on pin 13void setup() { pinMode(motor1Input1, OUTPUT); // sets all pins as output pinMode(motor1Input2, OUTPUT); pinMode(motor2Input1, OUTPUT); pinMode(motor2Input2, OUTPUT); pinMode(ledPin, OUTPUT);// pinMode(motor2Pwm, OUTPUT); > Disabled this line as analogWrite doesnt need pinMode to be defined// pinMode(motor1Pwm, OUTPUT); > Same as above}void loop(){ digitalWrite(motor1Input1, HIGH); // Motor1 on digitalWrite(motor1Input2,LOW); analogWrite(motor1Pwm,255); // Motor1 PWM Pulse digitalWrite(motor2Input1, HIGH); // Motor2 on digitalWrite(motor2Input2,LOW); analogWrite(motor2Pwm,255); // Motor2 PWM Pulse digitalWrite(ledPin,HIGH); // LED test }