printing values of potentiometer on serial

Dependencies:   mbed

main.cpp

Committer:
zatharv
Date:
2022-05-20
Revision:
0:57382fac83ca

File content as of revision 0:57382fac83ca:

#include "mbed.h"

Serial pc(USBTX,USBRX);
AnalogIn pot(PTB0);
float value;
int res;
int main() {
    while(1)
    {
        value = pot.read();
        res = value*10000;
        pc.printf("\n%d\r",res);
        wait(0.1);
    }
}