getting values from sensor and display those values on LCD

Dependencies:   TextLCD mbed

main.cpp

Committer:
papuxtream
Date:
2016-11-03
Revision:
0:266105102052

File content as of revision 0:266105102052:

#include "mbed.h"
#include "TextLCD.h"

 TextLCD lcd(p5,p6,p7,p8,p9,p10);
 AnalogIn ldr(p15);
 int main()
 {
    {lcd.cls();
    wait_ms(0.02);
    lcd.locate(0,0);
    lcd.printf("SENSOR OUTPUT VOLTAGE");}
    
while(1)
{int ldr_value=ldr;
  float voltage=ldr_value*(5.0/1023.0);
  lcd.locate(1,1);
  lcd.printf("%0.0f",voltage);
  lcd.printf("Volt");
  }
    
}