![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
SMART CLEO IR
Diff: main.cpp
- Revision:
- 0:d200cffd7784
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 28 02:59:46 2017 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "TextLCD.h" + +PinName pin_IR_A = PC_0; +PinName pin_IR_D = PC_12; + +AnalogIn adc_IR(pin_IR_A); +DigitalIn IR(pin_IR_D); + +// rs, rw, e, d0-d3 +TextLCD lcd(PB_12, PB_13, PB_14, PB_15, PA_9, PA_10, PA_11); + +int main() { + + int volt, ir_d; + lcd.printf(" Volt : [mV]"); + lcd.locate(0, 1); + lcd.printf(" IR Status : "); + while(1) { + volt = adc_IR.read()*3300; + ir_d = IR; + lcd.locate(8, 0); + lcd.printf("%4d", volt); + lcd.locate(13, 1); + lcd.printf("%d", ir_d); + wait(1); + } +}