Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
546 B
5
Indexable
Never
int in1 = 8;
int in2 = 9;
int in3 = 6;
int in4 = 7;
int ConA = 10;
int speed1;
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(10, OUTPUT);
}
void TurnMotorA(){ 
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
speed1 = analogRead(A0);
speed1 = speed1*0.2492668622; 
analogWrite(ConA,speed1);
}
void TurnMotorB(){ 
digitalWrite(in3, LOW); 
digitalWrite(in4, HIGH);
speed1 = analogRead(A0);
speed1 = speed1*0.2492668622;
analogWrite(ConA,speed1);
}
void loop() {
TurnMotorA();
TurnMotorB();
}
Leave a Comment