SMART CLEO IR

main.cpp

Committer:
SMART_CLEO
Date:
2017-09-28
Revision:
0:d200cffd7784

File content as of revision 0:d200cffd7784:

#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);
    }
}