Added various bits, main reformatted. Added .get to class Servo to allow waiting for rotation before recording information.
Fork of Lab6_Basic by
Diff: main.cpp
- Revision:
- 3:b787aa49b900
- Parent:
- 0:61b18b631f94
- Child:
- 4:b3a93554fedf
--- a/main.cpp Wed Aug 17 19:21:43 2016 +0000 +++ b/main.cpp Mon Sep 19 17:06:45 2016 +0000 @@ -1,13 +1,35 @@ #include "mbed.h" +#include "Motor.h" +#include "Servo.h" +/************************************* Lab5 Motor to servo ***************************/ +/* */ +/* File: main.cpp */ +/* Author: Ziad Eldebri */ +/* Date Created: 8/19/2016 */ +/* Description: */ +/* */ +/****************************************************************************************/ -DigitalOut gpo(D0); -DigitalOut led(LED_RED); +Servo my_servo(PTB3,PTE19,PTE18,PTE31); + +int main() { + +while (1) { -int main() -{ - while (true) { - gpo = !gpo; // toggle pin - led = !led; // toggle led - wait(0.2f); + +my_servo.set(45); +wait(4); + +my_servo.set(65); +wait(4); +my_servo.set(90); +wait(4); + +my_servo.set(135); +wait(4); + +my_servo.set(180); +wait(4); + } -} \ No newline at end of file +}