han back
/
CLEO_CDS
SMART CLEO CDS
main.cpp@0:2d4f287f9900, 2017-09-28 (annotated)
- Committer:
- SMART_CLEO
- Date:
- Thu Sep 28 02:10:35 2017 +0000
- Revision:
- 0:2d4f287f9900
SMART_CLEO
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SMART_CLEO | 0:2d4f287f9900 | 1 | #include "mbed.h" |
SMART_CLEO | 0:2d4f287f9900 | 2 | #include "TextLCD.h" |
SMART_CLEO | 0:2d4f287f9900 | 3 | |
SMART_CLEO | 0:2d4f287f9900 | 4 | PinName pin_CDS = PB_0; |
SMART_CLEO | 0:2d4f287f9900 | 5 | |
SMART_CLEO | 0:2d4f287f9900 | 6 | AnalogIn adc_CDS(pin_CDS); |
SMART_CLEO | 0:2d4f287f9900 | 7 | |
SMART_CLEO | 0:2d4f287f9900 | 8 | // rs, rw, e, d0-d3 |
SMART_CLEO | 0:2d4f287f9900 | 9 | TextLCD lcd(PB_12, PB_13, PB_14, PB_15, PA_9, PA_10, PA_11); |
SMART_CLEO | 0:2d4f287f9900 | 10 | |
SMART_CLEO | 0:2d4f287f9900 | 11 | int main() { |
SMART_CLEO | 0:2d4f287f9900 | 12 | |
SMART_CLEO | 0:2d4f287f9900 | 13 | int ADC_Data; |
SMART_CLEO | 0:2d4f287f9900 | 14 | lcd.printf(" CDS Program\n"); |
SMART_CLEO | 0:2d4f287f9900 | 15 | lcd.printf(" ADC Data : "); |
SMART_CLEO | 0:2d4f287f9900 | 16 | while(1) { |
SMART_CLEO | 0:2d4f287f9900 | 17 | ADC_Data = adc_CDS.read()*4095; |
SMART_CLEO | 0:2d4f287f9900 | 18 | lcd.locate(12, 1); |
SMART_CLEO | 0:2d4f287f9900 | 19 | lcd.printf("%4d", ADC_Data); |
SMART_CLEO | 0:2d4f287f9900 | 20 | wait(1); |
SMART_CLEO | 0:2d4f287f9900 | 21 | } |
SMART_CLEO | 0:2d4f287f9900 | 22 | } |