keyboard input, serial com test

Dependencies:   mbed DISCO_L475VG_IOT01A_wifi TextLCD USBHost

Committer:
duchonic
Date:
Mon Aug 05 18:26:58 2019 +0000
Revision:
4:c2cdba0bae47
Parent:
2:c1f316e932bc
Child:
5:0466445897b8
first

Who changed what in which revision?

UserRevisionLine numberNew contents of line
duchonic 0:6eeb987cb865 1 #include "mbed.h"
duchonic 2:c1f316e932bc 2 #include "TextLCD.h"
duchonic 0:6eeb987cb865 3
duchonic 0:6eeb987cb865 4 DigitalOut led1(LED1);
duchonic 2:c1f316e932bc 5 Serial pc(SERIAL_TX, SERIAL_RX);
duchonic 2:c1f316e932bc 6 AnalogIn button(A0); // Init button (SELECT, LEFT, UP, DOWN, RIGHT)
duchonic 4:c2cdba0bae47 7 TextLCD lcd(D8, D9, D4, D5, D6, D7); // LCD (RS, E, D4, D5, D6, D7);
duchonic 2:c1f316e932bc 8 PwmOut backlight(D10); // Backlight LCD
duchonic 0:6eeb987cb865 9
duchonic 0:6eeb987cb865 10 int main()
duchonic 4:c2cdba0bae47 11 {
duchonic 2:c1f316e932bc 12 // Set backlight period and duty cycle
duchonic 2:c1f316e932bc 13 backlight.period(0.002);
duchonic 2:c1f316e932bc 14 backlight = 1;
duchonic 2:c1f316e932bc 15
duchonic 2:c1f316e932bc 16 lcd.cls(); // Clear LCD
duchonic 2:c1f316e932bc 17 lcd.locate(1,0); // Set locate (1 row, 2 column)
duchonic 2:c1f316e932bc 18 lcd.printf("LCD Key Shield");
duchonic 4:c2cdba0bae47 19
duchonic 0:6eeb987cb865 20 while(1) {
duchonic 4:c2cdba0bae47 21 lcd.cls();
duchonic 4:c2cdba0bae47 22 lcd.locate(1,0);
duchonic 4:c2cdba0bae47 23 lcd.printf("%f", button.read());
duchonic 4:c2cdba0bae47 24 wait(1);
duchonic 0:6eeb987cb865 25 led1 = !led1;
duchonic 0:6eeb987cb865 26 }
duchonic 0:6eeb987cb865 27 }