Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
jack1930
Date:
Wed Oct 27 16:37:51 2021 +0000
Parent:
0:8f6ff5bb5a2d
Commit message:
STM32L152

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 8f6ff5bb5a2d -r 1a6fd44ce241 main.cpp
--- a/main.cpp	Wed Dec 23 16:58:19 2015 +0000
+++ b/main.cpp	Wed Oct 27 16:37:51 2021 +0000
@@ -5,15 +5,16 @@
 AnalogIn button(A0);    // Init button (SELECT, LEFT, UP, DOWN, RIGHT)
 // LCD (RS, E, D4, D5, D6, D7);
 TextLCD lcd(D8, D9, D4, D5, D6, D7);
-PwmOut backlight(D10);  // Backlight LCD
+//PwmOut backlight(D10);  // Backlight LCD
 DigitalOut led(LED1);
 
+
 int main() {
     
     // Set backlight period and duty cycle 
-    backlight.period(0.002);
-    backlight = 1;
-    
+    //backlight.period(0.002);
+    //backlight = 1;
+
     
     lcd.cls();                      // Clear LCD
     lcd.locate(1,0);                // Set locate (1 row, 2 column)
@@ -25,7 +26,7 @@
     while(1) {
         led = (led == 1) ? 0 : 1;
 
-        meas = button.read() * 1000; // Read the analog input value (value from 0.0 to 1.0) and convert to int value (from 0 to 1000)
+        meas = button * 1000; // Read the analog input value (value from 0.0 to 1.0) and convert to int value (from 0 to 1000)
         
         lcd.cls();
         lcd.locate(0,0);
@@ -34,17 +35,17 @@
         
         if (meas < 50) { 
             lcd.printf("BUTTON: Right ");
-            backlight = 0.5;        // Set 50% backlight 
+            //backlight = 0.5;        // Set 50% backlight 
         }
-        else if (meas < 210) { 
+        else if (meas < 250) { 
             lcd.printf("BUTTON: Up");
-            backlight = 1;          // Power ON backlight
+            //backlight = 1;          // Power ON backlight
         } 
-        else if (meas < 460){ 
+        else if (meas < 530){ 
             lcd.printf("BUTTON: Down");
-            backlight = 0;          // Power OFF backlight
+            //backlight = 0;          // Power OFF backlight
         } 
-        else if (meas < 720){ 
+        else if (meas < 780&&meas>735){ 
             lcd.printf("BUTTON: Left"); 
         } 
         else if (meas > 950){ 
diff -r 8f6ff5bb5a2d -r 1a6fd44ce241 mbed.bld
--- a/mbed.bld	Wed Dec 23 16:58:19 2015 +0000
+++ b/mbed.bld	Wed Oct 27 16:37:51 2021 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file