/********************************************** e-Gizmo PBot Uno Controller - MOTOR_TEST.ino This is for motor sample sketch to controls and move forward, reverse, turning right, turning left, and stop the motors. Set motor speed: PBot.SPEED(whichmotor, speed); Note: Forward Speed = 0 Full Stop;255 High, limit 250 Where: whichmotor = MOTOR_A or MOTOR_B, MOTOR_BOTH speed = 0 to 255 Set motor direction: PBot.DIRECTION(whichmotor, dir); Where: whichmotor = MOTOR_A or MOTOR_B, MOTOR_BOTH dir = MOTOR_FWD, MOTOR_REV; Codes by e-Gizmo Mechatronix Central http://www.e-gizmo.com March 17,2020 ************************************************/ #include "eGizmo_PBot_Uno.h" #include eGizmo_PBot_Uno PBot; int MotorSpeed = 120; //Set Speeds to 120 PWM int delaymsec = 2000; void setup() { PBot.BEGIN(); } void loop() { //Move Forward PBot.FORWARD(MotorSpeed); delay(delaymsec); //Reverse PBot.REVERSE(MotorSpeed); delay(delaymsec); //Turn Right PBot.TURNRIGHT(MotorSpeed); delay(delaymsec); //Turn Left PBot.TURNLEFT(MotorSpeed); delay(delaymsec); //Stop PBot.STOP(); delay(delaymsec); //Extreme Right/SpinRight PBot.SPINRIGHT(MotorSpeed); delay(delaymsec); //Extreme Left/SpinLeft PBot.SPINLEFT(MotorSpeed); delay(delaymsec); }