AUP_Lab4_LCD

Dependencies:   C12832 mbed

Fork of AUP_Lab2_PWM_UART by Lei Lei

Revision:
2:eac7cbeb9da0
Parent:
1:08431d9e3d95
--- a/main.cpp	Tue Jul 07 23:27:48 2015 +0000
+++ b/main.cpp	Wed Jul 08 00:04:40 2015 +0000
@@ -1,10 +1,14 @@
 #include "mbed.h"
+
+// 添加液晶屏类库
 #include "C12832.h"
 
 PwmOut led(D5);
 DigitalIn button_up(A2);
 DigitalIn button_center(D4);
 DigitalIn button_down(A3);
+
+// 初始化液晶屏
 C12832 lcd(D11, D13, D12, D7, D10);
 
 double brightness = 1.0;
@@ -13,10 +17,12 @@
 int main()
 {
     int bt_flag = 0;
+    
+    // 液晶屏清屏
     lcd.cls();
-    lcd.locate(0,0);
-    lcd.printf("Hello PWM!\r\n");
-    // Set PWM
+    lcd.locate(0, 0);
+    lcd.printf("Hello LCD!");
+
     led.write(brightness);
 
     while (1) {
@@ -34,6 +40,8 @@
             brightness = (brightness>1.0)?0.0:brightness;
             brightness = (brightness<0.0)?1.0:brightness;
             led.write(brightness);
+            
+            // 在液晶屏上显示LED的亮度值
             lcd.locate(0,0);
             lcd.printf("Brightness = %.1f\r\n", 1.0-brightness);
         }