Menu

[solved] – Question 98999

Modify the example in Adruino to such that when the motors turn clockwise, the green light blinks, and when the motor turns counter-clockwise, the red light blinks.

Example:

void setup() {

prizm.PrizmBegin(); // Initialize the PRIZM controller
}

void loop() { // repeat in a loop

prizm.setMotorPower(1,25); // spin Motor 1 CW at 25% power
delay(5000); // wait while the motor runs for 5 seconds
prizm.setMotorPower(1,0); // stop motor (coast to stop)
delay(2000); // After stopping, wait here for 2 seconds
prizm.setMotorPower(1,-25); // spin Motor 1 CCW at 25% power
delay(5000); // wait while the motor runs for 5 seconds
prizm.setMotorPower(1,0); // stop motor (coast to stop);
delay(2000); // After stopping, wait here for 2 seconds, then repeat

}

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *