#pragma config(CircuitBoardType, typeCktBoardUNO) #pragma config(Motor, servo_A, leftMotor, tmotorServoContinuousRotation, openLoop, IOPins, dgtl13, None) #pragma config(Motor, servo_B, rightMotor, tmotorServoContinuousRotation, openLoop, IOPins, dgtl12, None) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /* R O B O T C F O R A R D U I N O M A K I N G T U R N S Ron Kessler Created 8/19/2018 Updated 8/20/2018 2-1- Making turns PURPOSE: This shows how to make pivot and spin turns on the Arduino using the same code as we did for the Lego NXT. SETUP: rt = digital pin 12, left = digital pin 13. This matches the motor controller board. The numbers used to control continuous rotation servos is from -127 to +127 with 0 = stop. The 127 is full speed CCW and -127 is full speed CW. Orient yourself when you plan which direction to rotate them. */ task main() { //---spin right motor[leftMotor]= 127; //go ccw Drivers side remember! motor[rightMotor] = 127; //go ccw on passenger side. wait1Msec(2000); //---spin left motor[leftMotor]= -127; //go cw Drivers side remember! motor[rightMotor] = -127; //go cw on passenger side. wait1Msec(2000); //Do PIVOT turns //---we hold one motor off & the other one moves. motor[leftMotor]= 0; motor[rightMotor] = -127; wait1Msec(2000); motor[leftMotor]= 127; motor[rightMotor] = 0; wait1Msec(2000); //Go Forward motor[leftMotor]= 127; motor[rightMotor] = -127; wait1Msec(2000); //Go Backwards & stop motor[leftMotor]= -127; motor[rightMotor] = 127; wait1Msec(2000); }