Created
March 26, 2014 03:53
-
-
Save eggie5/9776714 to your computer and use it in GitHub Desktop.
tank sweep sharknado
This file contains hidden or 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 <SabertoothSimplified.h> | |
| SabertoothSimplified ST; | |
| void setup() | |
| { | |
| SabertoothTXPinSerial.begin(9600); | |
| ST.drive(0); | |
| ST.turn(0); | |
| } | |
| void loop() | |
| { | |
| int power; | |
| // Don't turn. Ramp from going backwards to going forwards, waiting 20 ms (1/50th of a second) per value. | |
| for (power = -127; power <= 127; power ++) | |
| { | |
| ST.drive(power); | |
| delay(20); | |
| } | |
| // Now, let's use a power level of 20 (out of 127) forward. | |
| // This way, our turning will have a radius. Mostly, the command | |
| // is just to demonstrate you can use drive() and turn() at the same time. | |
| ST.drive(20); | |
| // Ramp turning from full left to full right SLOWLY by waiting 50 ms (1/20th of a second) per value. | |
| for (power = -127; power <= 127; power ++) | |
| { | |
| ST.turn(power); | |
| delay(50); | |
| } | |
| // Now stop turning, and stop driving. | |
| ST.turn(0); | |
| ST.drive(0); | |
| // Wait a bit. This is so you can catch your robot if you want to. :-) | |
| delay(5000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment