Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "simpletools.h" //Include simpletools header
- #include "servo.h" //Include servo header
- int main() //main function
- {
- servo_angle(17, 1800); //Servo to 180 degrees
- pause(2000); //Wait for 2 seconds
- servo_angle(17, 0); //Servo to 0 degrees
- pause(1000); //This pause was during movement, not sure how to only have 1
- pause(1000); //This is the one that actually pauses. If it's not here, it doesn't pause
- servo_angle(17, 1800); //Servo to 180 degrees
- pause(4500); //Wait for 4.5 seconds
- high(26); //LED 26 ON
- pause(100); //Wait 10ms
- low(26); //LED 26 OFF
- pause(500); //Wait half second
- servo_angle(17,900); //Servo to 90 degrees
- blink(); //Calls the blink function *IT'S ALIIIIVE!!!*
- servo_stop(); //Stop servo
- }
- void blink(void) //blink function
- {
- high(27); //This is a test, I want to see if I can avoid
- pause(50); //putting 15 lines of blink code in main() to make it look nicer
- low(27); //Result, it works...and looks nicer.
- pause(50); //Now, I'd LIKE to know how to have a blink sequence that does an
- high(27); //On/Off for as long as the motor is running, rather than "cheating"
- pause(50); //and trial an erroring the number of blinks it would take to blink
- low(27); //during the duration of the rotation.
- pause(50); //This function SHOULD be 4 lines, high/pause/low/pause then repeat
- high(27);
- pause(50);
- low(27);
- pause(50);
- high(27);
- pause(50);
- low(27);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement