const const const const const const

int int int int int int

dirA1_pin = 2; dirB1_pin = 4; pwm1_pin = 9; dirA2_pin = 7; dirB2_pin = 8; pwm2_pin = 10;

void setup(){ pinMode(dirA1_pin,OUTPUT); pinMode(dirB1_pin,OUTPUT); pinMode(pwm1_pin,OUTPUT); pinMode(dirA1_pin,OUTPUT); pinMode(dirB1_pin,OUTPUT); pinMode(pwm1_pin,OUTPUT); //pinMode(_EN2DIAG2,INPUT); //pinMode(_CS2,INPUT); } void loop(){ } void moveForward(int speed){ digitalWrite(dirA1_pin,HIGH); digitalWrite(dirB1_pin,LOW); digitalWrite(dirA2_pin,HIGH); digitalWrite(dirB2_pin,LOW); analogWrite(pwm1_pin, speed*255); analogWrite(pwm2_pin, speed*255); } void stop(){ } void turnLeft(){ } void turnRight(){ } void turn180(){ digitalWrite(dirA1_pin,LOW); digitalWrite(dirB1_pin,HIGH); digitalWrite(dirA2_pin,LOW); digitalWrite(dirB2_pin,HIGH); }

Sign up to vote on this title
UsefulNot useful