Last active
July 17, 2019 17:16
-
-
Save pratimugale/76e6b637896ac96093ae396efd5f020e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "driver_lib.h" | |
#include <iostream> | |
using namespace std; | |
int main(){ | |
Driver& d = Driver::get(); | |
d.wake(); | |
d.activateMotor(360.0, 60.0, FULL, ANTICLOCKWISE); // 360 degrees at 60 RPM in full step mode in anticlockwise direction | |
d.activateMotor(360.0, 60.0, HALF, ANTICLOCKWISE); | |
d.activateMotor(360.0, 60.0, QUARTER, ANTICLOCKWISE); | |
d.activateMotor(360.0, 60.0, EIGHT, ANTICLOCKWISE); | |
d.activateMotor(360.0, 60.0, EIGHT); | |
d.activateMotor(360.0, 60.0, QUARTER); | |
d.activateMotor(360.0, 60.0, HALF); | |
d.activateMotor(360.0, 60.0, FULL); | |
// To demonstrate sleeping - The motor should be able to freely rotate for 10 seconds | |
d.sleep(); | |
usleep(5000000); | |
d.wake(); | |
d.activateMotor(180.0, 150.0, EIGHT, ANTICLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, CLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, ANTICLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, CLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, ANTICLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, CLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, ANTICLOCKWISE); | |
d.activateMotor(180.0, 150.0, EIGHT, CLOCKWISE); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment