han back
/
CLEO_GAS
SMART CLEO Gas
main.cpp@0:5251f7d3452f, 2017-09-28 (annotated)
- Committer:
- SMART_CLEO
- Date:
- Thu Sep 28 02:14:11 2017 +0000
- Revision:
- 0:5251f7d3452f
SMART_CLEO
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SMART_CLEO | 0:5251f7d3452f | 1 | #include "mbed.h" |
SMART_CLEO | 0:5251f7d3452f | 2 | #include "TextLCD.h" |
SMART_CLEO | 0:5251f7d3452f | 3 | |
SMART_CLEO | 0:5251f7d3452f | 4 | PinName pin_GAS = PA_1; |
SMART_CLEO | 0:5251f7d3452f | 5 | |
SMART_CLEO | 0:5251f7d3452f | 6 | AnalogIn adc_Gas(pin_GAS); |
SMART_CLEO | 0:5251f7d3452f | 7 | |
SMART_CLEO | 0:5251f7d3452f | 8 | // rs, rw, e, d0-d3 |
SMART_CLEO | 0:5251f7d3452f | 9 | TextLCD lcd(PB_12, PB_13, PB_14, PB_15, PA_9, PA_10, PA_11); |
SMART_CLEO | 0:5251f7d3452f | 10 | |
SMART_CLEO | 0:5251f7d3452f | 11 | int main() { |
SMART_CLEO | 0:5251f7d3452f | 12 | |
SMART_CLEO | 0:5251f7d3452f | 13 | int volt; |
SMART_CLEO | 0:5251f7d3452f | 14 | lcd.printf(" GAS Program\n"); |
SMART_CLEO | 0:5251f7d3452f | 15 | lcd.printf(" Volt : [mV]"); |
SMART_CLEO | 0:5251f7d3452f | 16 | while(1) { |
SMART_CLEO | 0:5251f7d3452f | 17 | volt = adc_Gas.read()*3300; |
SMART_CLEO | 0:5251f7d3452f | 18 | lcd.locate(8, 1); |
SMART_CLEO | 0:5251f7d3452f | 19 | lcd.printf("%4d", volt); |
SMART_CLEO | 0:5251f7d3452f | 20 | wait(0.5); |
SMART_CLEO | 0:5251f7d3452f | 21 | } |
SMART_CLEO | 0:5251f7d3452f | 22 | } |