Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
856 B
11
Indexable
Never
//Fill in the blanks with your wires, change them around until it works
int R_REVERSE = ??;
int R_FORWARD = ??;
int L_REVERSE = ??;
int L_FORWARD = ??;
 
int TOP_SPEED = ??; // Must be a number between ~150 and 255
 
void setup() {
pinMode(R_REVERSE, OUTPUT);
pinMode(R_FORWARD, OUTPUT);
pinMode(L_REVERSE, OUTPUT);
pinMode(L_FORWARD, OUTPUT);
}
 
void loop() {
 
//Make it go forward
analogWrite(R_FORWARD, TOP_SPEED);
analogWrite(L_FORWARD, TOP_SPEED);
analogWrite(R_REVERSE, 0);
analogWrite(L_REVERSE, 0);
 
delay(1000);
 
//Make it go forward, at half speed
analogWrite(R_FORWARD, TOP_SPEED/2);
analogWrite(L_FORWARD, TOP_SPEED/2);
analogWrite(R_REVERSE, 0);
analogWrite(L_REVERSE, 0);
 
 
delay(1000);
       
//Make it stop
analogWrite(R_FORWARD, 0);
analogWrite(L_FORWARD, 0);
analogWrite(R_REVERSE, 0);
analogWrite(L_REVERSE, 0);
 
delay(1000);
 
}