...

Dependencies:   mbed

main.cpp

Committer:
anmolhardik
Date:
2017-02-09
Revision:
0:7f5d61589804

File content as of revision 0:7f5d61589804:

#include "mbed.h"

Serial pc(USBTX,USBRX);
AnalogIn ldr(PTB1);
int main()
{
    char c;
    float v1=0;
    
   while(1)
   { 
    if(pc.readable())
      {
        c= pc.getc();
        if(c=='l') 
        { 
          v1=ldr.read()*3.3;
          pc.printf("ldr=%0.2f\r\n",v1);
    } 
   }
  } 
 }