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
}
1
Expert's answer
2019-11-21T06:30:23-0500
Dear N/A, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Comments
Leave a comment