Added various bits, main reformatted. Added .get to class Servo to allow waiting for rotation before recording information.
Fork of Lab6_Basic by
main.cpp@3:b787aa49b900, 2016-09-19 (annotated)
- Committer:
- ziadeldebri
- Date:
- Mon Sep 19 17:06:45 2016 +0000
- Revision:
- 3:b787aa49b900
- Parent:
- 0:61b18b631f94
- Child:
- 4:b3a93554fedf
Scott Test;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ziadeldebri | 0:61b18b631f94 | 1 | #include "mbed.h" |
ziadeldebri | 3:b787aa49b900 | 2 | #include "Motor.h" |
ziadeldebri | 3:b787aa49b900 | 3 | #include "Servo.h" |
ziadeldebri | 3:b787aa49b900 | 4 | /************************************* Lab5 Motor to servo ***************************/ |
ziadeldebri | 3:b787aa49b900 | 5 | /* */ |
ziadeldebri | 3:b787aa49b900 | 6 | /* File: main.cpp */ |
ziadeldebri | 3:b787aa49b900 | 7 | /* Author: Ziad Eldebri */ |
ziadeldebri | 3:b787aa49b900 | 8 | /* Date Created: 8/19/2016 */ |
ziadeldebri | 3:b787aa49b900 | 9 | /* Description: */ |
ziadeldebri | 3:b787aa49b900 | 10 | /* */ |
ziadeldebri | 3:b787aa49b900 | 11 | /****************************************************************************************/ |
ziadeldebri | 0:61b18b631f94 | 12 | |
ziadeldebri | 3:b787aa49b900 | 13 | Servo my_servo(PTB3,PTE19,PTE18,PTE31); |
ziadeldebri | 3:b787aa49b900 | 14 | |
ziadeldebri | 3:b787aa49b900 | 15 | int main() { |
ziadeldebri | 3:b787aa49b900 | 16 | |
ziadeldebri | 3:b787aa49b900 | 17 | while (1) { |
ziadeldebri | 0:61b18b631f94 | 18 | |
ziadeldebri | 3:b787aa49b900 | 19 | |
ziadeldebri | 3:b787aa49b900 | 20 | my_servo.set(45); |
ziadeldebri | 3:b787aa49b900 | 21 | wait(4); |
ziadeldebri | 3:b787aa49b900 | 22 | |
ziadeldebri | 3:b787aa49b900 | 23 | my_servo.set(65); |
ziadeldebri | 3:b787aa49b900 | 24 | wait(4); |
ziadeldebri | 3:b787aa49b900 | 25 | my_servo.set(90); |
ziadeldebri | 3:b787aa49b900 | 26 | wait(4); |
ziadeldebri | 3:b787aa49b900 | 27 | |
ziadeldebri | 3:b787aa49b900 | 28 | my_servo.set(135); |
ziadeldebri | 3:b787aa49b900 | 29 | wait(4); |
ziadeldebri | 3:b787aa49b900 | 30 | |
ziadeldebri | 3:b787aa49b900 | 31 | my_servo.set(180); |
ziadeldebri | 3:b787aa49b900 | 32 | wait(4); |
ziadeldebri | 3:b787aa49b900 | 33 | |
ziadeldebri | 0:61b18b631f94 | 34 | } |
ziadeldebri | 3:b787aa49b900 | 35 | } |