-

Dependencies:   mbed LCDLib

main.cpp

Committer:
meksc
Date:
2019-06-06
Revision:
0:d84281c81bec

File content as of revision 0:d84281c81bec:

#include "mbed.h"
#include "TextLCD.h"

DigitalOut myled(PC_13);
AnalogIn adc(PA_0);
Serial serial(PA_9, PA_10);

TextLCD lcd(PA_4,PA_5,PA_6,PB_12,PB_13,PB_14,PB_15);
int main() {
    serial.baud(115200);
    float tensao;
    
        while(1) {
        tensao=3.3*adc.read();
        lcd.gotoxy(1,1);
        lcd.printf("Tensao: %.2f",tensao);
        serial.printf ("Tensao: %.2f\n",tensao);
        myled = 1; // LED is ON
        wait(0.2); // 200 ms
        myled = 0; // LED is OFF
        wait(1.0); // 1 sec
    }
}