Angle and rpm will be output

Dependencies:   mbed

main.cpp

Committer:
satoyuki1111
Date:
2016-04-28
Revision:
0:38e59ba08114

File content as of revision 0:38e59ba08114:

#include "mbed.h"

DigitalOut led(LED1);
AnalogIn   potentiometer(p20);

int main() 
{
    float data  = 0;
    int   rpm   = 0;
    float angle = 0;
    while(true) 
    {
        data = potentiometer;
        data *=10;
        rpm  = data;
        angle = ((((data - rpm) * 1000000) *360) / 1000000);
        
        
        
        printf("%10f %3d %2d\n\r",float(potentiometer),int(angle),rpm);
        
    }
}