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:
- 9:4bd820ca8300
- Parent:
- 7:10554a04a34f
- Child:
- 10:37cbc2888e09
--- a/main.cpp Sat Nov 19 09:10:23 2016 +0000 +++ b/main.cpp Sat Nov 19 09:13:10 2016 +0000 @@ -14,6 +14,7 @@ Servo my_servo(PTB3,PTE19,PTE18,PTE31); AnalogIn Spanel(PTB2); //uint16_t reading_array[3]; +const int max_degree = 120; const int size=20; unsigned int reading_array[size]; int position_array[size]; @@ -30,7 +31,7 @@ for (i=0; i<size;i++) { - position_array[i] = i*120/size +20 ; + position_array[i] = i*max_degree/size +20 ; }