Lei Lei
/
AUP_Lab4_LCD
AUP_Lab4_LCD
Fork of AUP_Lab2_PWM_UART by
Diff: main.cpp
- Revision:
- 1:08431d9e3d95
- Parent:
- 0:65e58765adf7
- Child:
- 2:eac7cbeb9da0
--- a/main.cpp Thu May 21 02:23:19 2015 +0000 +++ b/main.cpp Tue Jul 07 23:27:48 2015 +0000 @@ -1,10 +1,11 @@ #include "mbed.h" +#include "C12832.h" PwmOut led(D5); DigitalIn button_up(A2); DigitalIn button_center(D4); DigitalIn button_down(A3); -Serial pc(SERIAL_TX, SERIAL_RX); +C12832 lcd(D11, D13, D12, D7, D10); double brightness = 1.0; double brightness_inc = 0.1; @@ -12,8 +13,9 @@ int main() { int bt_flag = 0; - pc.baud(9600); - pc.printf("Hello PWM!\r\n"); + lcd.cls(); + lcd.locate(0,0); + lcd.printf("Hello PWM!\r\n"); // Set PWM led.write(brightness); @@ -32,7 +34,8 @@ brightness = (brightness>1.0)?0.0:brightness; brightness = (brightness<0.0)?1.0:brightness; led.write(brightness); - pc.printf("Brightness = %.1f\r\n", 1.0-brightness); + lcd.locate(0,0); + lcd.printf("Brightness = %.1f\r\n", 1.0-brightness); } wait(0.2); // 200 ms }