Isme plot hotai LDR aur POT ka value, wrt time serial plotter ke graph me. Baud rate 9600 select karneka aur axes 2 select karna mat bhulna

Dependencies:   mbed

main.cpp

Committer:
akashlal
Date:
2016-07-01
Revision:
0:709cf4309909
Child:
1:3151bf0df238

File content as of revision 0:709cf4309909:

#include "mbed.h"

Serial pc(USBTX,USBRX);
AnalogIn pot(PTB0);
AnalogIn ldr(PTB1);
//This progeram is to be submitted for report 02
float potf; //Declaring float value for Potentiometer reading
int poti; //Declaring int value for Potentiometer reading
float ldrf; //Declaring float value for LDR reading
int ldri; //Declaring Integer value for LDR reading

int main() 
{
    while(1) 
    {
        ldrf=ldr.read();
        ldri=ldrf*1000;
        potf=pot.read();
        poti=potf*1000;
        pc.printf("$%d %d;",poti,ldri); //Printing value of LDR and Pot Float value.
        pc.printf("\n \r");
    }
}