Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop(){
- if(digitalRead(switchPin) == HIGH){
- moveF(587);
- turnR(170);
- moveF(587);
- turnR(170);
- moveF(587);
- turnR(170);
- moveF(587);
- turnR(170);
- }
- }
- void moveF(volatile unsigned int countR){
- ticks = 0;
- for(int i - 0; i < countR; i++){
- leftMotor(255);
- rightMotor(255);
- }
- leftMotor(0);
- rightMotor(0);
- delay(500)
- }
- void turnL(volatile unsigned int countR){
- ticks = 0;
- for(int i - 0; i < countR; i++){
- leftMotor(-255);
- rightMotor(255);
- }
- leftMotor(0);
- rightMotor(0);
- delay(500)
- }
- void turnR(volatile unsigned int countR){
- ticks = 0;
- for(int i - 0; i < countR; i++){
- leftMotor(255);
- rightMotor(-255);
- }
- leftMotor(0);
- rightMotor(0);
- delay(500)
- }
- void rMotorCount(){
- countR++;
- }
- void lMotorCount(){
- countL++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement