Terrabots / Mbed 2 deprecated turn_pot

Dependencies:   Motor mbed

main.cpp

Committer:
simplyellow
Date:
2016-10-24
Revision:
0:d97c87993116
Child:
1:532b7273ebc6

File content as of revision 0:d97c87993116:

#include "mbed.h"
#include "Motor.h"

//Motor turn(p23, p28);
AnalogIn pot(p15);
Serial pc(USBTX, USBRX);

float value;
float angle;

/*
the angular range of the pot is 66.8 degrees
the average float range is 0.2226
so +/- 33.4 degrees
*/

int main() {
    while(1){
        value = (float) pot;
        angle = value
        pc.printf("%f\n\r", angle);
        
        wait(0.2);
    }
}
/* DumpTruck pot measurements
0.274 to 0.498 -> 0.224
0.272 to 0.495 -> 0.223
0.277 to 0.498 -> 0.221

*/