![](/media/cache/profiles/09bd2862fe3035ad3223816b439045e3.50x50_q85.jpg)
光センサ
Fork of CDS_LCD by
main.cpp@0:48b9e99fafc8, 2013-05-23 (annotated)
- Committer:
- MasudaToshio
- Date:
- Thu May 23 10:06:07 2013 +0000
- Revision:
- 0:48b9e99fafc8
????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MasudaToshio | 0:48b9e99fafc8 | 1 | #include "mbed.h" |
MasudaToshio | 0:48b9e99fafc8 | 2 | #include "TextLCD.h" |
MasudaToshio | 0:48b9e99fafc8 | 3 | |
MasudaToshio | 0:48b9e99fafc8 | 4 | AnalogIn CDS(p16); |
MasudaToshio | 0:48b9e99fafc8 | 5 | TextLCD lcd(p24, p26, p27, p28, p29, p30); |
MasudaToshio | 0:48b9e99fafc8 | 6 | |
MasudaToshio | 0:48b9e99fafc8 | 7 | ///////////////////////////////////////////////////// |
MasudaToshio | 0:48b9e99fafc8 | 8 | // main |
MasudaToshio | 0:48b9e99fafc8 | 9 | ///////////////////////////////////////////////////// |
MasudaToshio | 0:48b9e99fafc8 | 10 | int main(void) { |
MasudaToshio | 0:48b9e99fafc8 | 11 | float a_in , t_cds ; |
MasudaToshio | 0:48b9e99fafc8 | 12 | lcd.cls(); |
MasudaToshio | 0:48b9e99fafc8 | 13 | |
MasudaToshio | 0:48b9e99fafc8 | 14 | while(1) { |
MasudaToshio | 0:48b9e99fafc8 | 15 | a_in = ( CDS ); |
MasudaToshio | 0:48b9e99fafc8 | 16 | |
MasudaToshio | 0:48b9e99fafc8 | 17 | t_cds = ( 2.7 * exp( a_in ) + ( -2.55 ) ) ; |
MasudaToshio | 0:48b9e99fafc8 | 18 | t_cds = pow( 10 , t_cds ) ; |
MasudaToshio | 0:48b9e99fafc8 | 19 | |
MasudaToshio | 0:48b9e99fafc8 | 20 | lcd.locate(0,0); |
MasudaToshio | 0:48b9e99fafc8 | 21 | lcd.printf("%3.0F lx %5.3F V", t_cds, a_in); |
MasudaToshio | 0:48b9e99fafc8 | 22 | wait(.5); |
MasudaToshio | 0:48b9e99fafc8 | 23 | } |
MasudaToshio | 0:48b9e99fafc8 | 24 | |
MasudaToshio | 0:48b9e99fafc8 | 25 | return 0; |
MasudaToshio | 0:48b9e99fafc8 | 26 | } |