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:
- 10:37cbc2888e09
- Parent:
- 9:4bd820ca8300
diff -r 4bd820ca8300 -r 37cbc2888e09 main.cpp --- a/main.cpp Sat Nov 19 09:13:10 2016 +0000 +++ b/main.cpp Sat Nov 19 09:37:32 2016 +0000 @@ -14,14 +14,15 @@ 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]; -//uint16_t largest = 0; -unsigned int largest = 0; -int largesti = 0; -int i; +const uint16_t max_degree = 120; +const uint16_t size=20; +unsigned int reading_array[size]; +//unsigned int reading_array[size]; +unsigned int position_array[size]; +unsigned int largest = 0; +//unsigned int largest = 0; +unsigned int largesti = 0; +unsigned int i; //Serial pc(USBTX, USBRX); @@ -66,7 +67,7 @@ } //write analog values (integers) to array - reading_array[i] = Spanel.read()*10000; + reading_array[i] = Spanel.read_u16()*100; }