光センサ

Dependencies:   TextLCD mbed

Fork of CDS_LCD by toshio masuda

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 AnalogIn CDS(p16);
00005 TextLCD lcd(p24, p26, p27, p28, p29, p30);
00006 
00007 /////////////////////////////////////////////////////
00008 //      main
00009 /////////////////////////////////////////////////////
00010 int main(void) {
00011         float a_in , t_cds ;
00012     lcd.cls();
00013 
00014     while(1) {
00015         a_in = ( CDS );
00016         
00017         t_cds = (  2.7 * exp( a_in )  + ( -2.55 )  )  ;
00018         t_cds = pow( 10 , t_cds ) ;
00019 
00020         lcd.locate(0,0);
00021         lcd.printf("%3.0F lx  %5.3F V", t_cds, a_in);
00022         wait(.5);
00023     }
00024 
00025     return 0;
00026 }