Simple version for outreach using https://os.mbed.com/users/wsteenberg/code/

Dependencies:   mbed LCD_DISCO_F469NI TS_DISCO_F469NI BSP_DISCO_F469NI

Files at this revision

API Documentation at this revision

Comitter:
dcspencer
Date:
Fri Jul 12 12:04:18 2019 +0000
Parent:
0:ebf3f36f3a64
Commit message:
Test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 25 12:38:48 2018 +0000
+++ b/main.cpp	Fri Jul 12 12:04:18 2019 +0000
@@ -29,42 +29,42 @@
 
     lcd_.Clear(LCD_COLOR_WHITE);                                        // Set LCD Background colour
    
-    Slider sld1(lcd_, ts_, 20, 350, 220, 40, 5, 1, 20,      
-                 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 1, "Slider1", Font20);   // Define sld1 slider            
-    sld1.Render();                                                          // Draw sld1 Slider  
+  //  Slider sld1(lcd_, ts_, 20, 350, 220, 40, 5, 1, 20,      
+  //               LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 1, "Slider1", Font20);   // Define sld1 slider            
+   // sld1.Render();                                                          // Draw sld1 Slider  
    
-    Slider Slider2(lcd_, ts_, 300, 350, 300, 40, 50, 1, 100,      
-                 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Slider2", Font20);   // Define Slider2 slider            
-    Slider2.Render();                                                       // Draw Slider2 Slider      
+  //  Slider Slider2(lcd_, ts_, 300, 350, 300, 40, 50, 1, 100,      
+  //               LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Slider2", Font20);   // Define Slider2 slider            
+  //  Slider2.Render();                                                       // Draw Slider2 Slider      
        
-    Button btn1(lcd_, ts_, 20, 100, 120, 60,            
-                 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 1, "BUTTON1", Font20);  // Define btn1 button            
-    btn1.Render();                                                         // Draw btn1 button
+   Button btn1(lcd_, ts_, 20, 100, 120, 60,            
+              LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 1, "BUTTON1", Font20);  // Define btn1 button            
+   btn1.Render();                                                         // Draw btn1 button
     
-    Button test(lcd_, ts_, 160, 100, 120, 60,
-                 LCD_COLOR_DARKBLUE, LCD_COLOR_GREEN, 1, "TEST", Font20);  // Define test button                   
-    test.Render();                                                         // Draw test button
+    Button btn2(lcd_, ts_, 160, 100, 120, 60,
+                 LCD_COLOR_DARKBLUE, LCD_COLOR_GREEN, 1, "BUTTON2", Font20);  // Define test button                   
+    btn2.Render();                                                         // Draw test button
     
-    Button show(lcd_, ts_, 300, 100, 120, 60,            
-                 LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1,  "SHOW", Font20);     // Define hide button            
-    show.Hide();  
+  //  Button show(lcd_, ts_, 300, 100, 120, 60,            
+  //               LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1,  "SHOW", Font20);     // Define hide button            
+  //  show.Hide();  
     
-    Button hide(lcd_, ts_, 300, 100, 120, 60,            
-                 LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1,  "HIDE", Font20);     // Define hide button             
-    hide.Render();                                                         // Draw hide button
+  //  Button hide(lcd_, ts_, 300, 100, 120, 60,            
+  //               LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1,  "HIDE", Font20);     // Define hide button             
+  //  hide.Render();                                                         // Draw hide button
     
-    Button button3D(lcd_, ts_, 580, 100, 160, 60,            
-                 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "3D BUTTON", Font20);    // Define button3D button            
-    button3D.Render();                                                         // Draw 3Dbutton button
+   // Button button3D(lcd_, ts_, 580, 100, 160, 60,            
+   //              LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "3D BUTTON", Font20);    // Define button3D button            
+   // button3D.Render();                                                         // Draw 3Dbutton button
 
 
 
     lcd_.SetTextColor(LCD_COLOR_BLACK);                                                         // Set Text colour to Black
     lcd_.SetFont(&Font20);                                                                      // Font size 20
-    lcd_.DisplayStringAt(5, 5, (uint8_t *)"Button / Slider driver for DISCO_F469", LEFT_MODE);  // Display main header text
+    lcd_.DisplayStringAt(5, 5, (uint8_t *)"Button example for DISCO_F469", LEFT_MODE);  // Display main header text
 
     lcd_.SetFont(&Font16);                                                                      // Font size 16
-    lcd_.DisplayStringAt(5, 45, (uint8_t *)"Button example", LEFT_MODE);                        // Display secondary header text
+    lcd_.DisplayStringAt(5, 45, (uint8_t *)"More text", LEFT_MODE);                        // Display secondary header text
 
 
     while (true)                                                    // Main program loop
@@ -76,49 +76,9 @@
         
 
     
-        if (sld1.Moved())                                           // Check if sld1 Slider was touched and run instructions if true
-        {    
-            led_blue = 0; 
-            lcd_.SetTextColor(LCD_COLOR_BLACK);                     
-            lcd_.FillRect(85, 265, 80, 40);                         // Draw border to display Slider Control Value
-            lcd_.SetTextColor(LCD_COLOR_WHITE);
-            lcd_.FillRect(95, 270, 60, 30);                         // Draw border to display Slider Control Value                                     
-            
-            sprintf(char_SliderDisplayValue, "%3d", (int) SliderDisplayValue_);                     // Convert integer to text
-            lcd_.SetFont(&Font16);                                                                  // Set Font size
-            lcd_.SetTextColor(LCD_COLOR_BLACK);                                                     // Set Font colour
-            lcd_.DisplayStringAt(100, 280, (uint8_t *)char_SliderDisplayValue, LEFT_MODE);          // Write Slider Control Value to the LCD
-            
-            if (SliderDisplayValue_ < 10)                                                           // Slider Control Value decision
-                {
-                    lcd_.DisplayStringAt(60, 330, (uint8_t *)"                     ", LEFT_MODE);   // Overwrite previous text
-                    lcd_.DisplayStringAt(60, 330, (uint8_t *)"SLIDER1 < 50%", LEFT_MODE);           // Write text to LCD
-                }
-            else if (SliderDisplayValue_ == 10)                                                     // Slider Control Value decision
-                {  
-                    lcd_.DisplayStringAt(60, 330, (uint8_t *)"                     ", LEFT_MODE);   // Overwrite previous text
-                    lcd_.DisplayStringAt(60, 330, (uint8_t *)"SLIDER1 = 50%", LEFT_MODE);           // Write text to LCD
-                }
-            else                                                                                    // Slider Control Value decision
-                {  
-                    lcd_.DisplayStringAt(60, 330, (uint8_t *)"                     ", LEFT_MODE);   // Overwrite previous text
-                    lcd_.DisplayStringAt(60, 330, (uint8_t *)"SLIDER1 > 50%", LEFT_MODE);           // Write text to LCD
-                }          
-        }                                                                                           // End sld1 instructions
+        
 
-        if (Slider2.Moved())                                      // Check if Slider2 Slider was touched and run instructions if true
-        {    
-            led_green = 0; 
-            lcd_.SetTextColor(LCD_COLOR_BLACK);                     
-            lcd_.FillRect(400, 265, 80, 40);                         // Draw border to display Slider Control Value
-            lcd_.SetTextColor(LCD_COLOR_WHITE);
-            lcd_.FillRect(410, 270, 60, 30);                         // Draw border to display Slider Control Value                                     
-            
-            sprintf(char_SliderDisplayValue, "%3d", (int) SliderDisplayValue_);                     // Convert integer to text
-            lcd_.SetFont(&Font16);                                                                  // Set Font size
-            lcd_.SetTextColor(LCD_COLOR_BLACK);                                                     // Set Font colour
-            lcd_.DisplayStringAt(415, 280, (uint8_t *)char_SliderDisplayValue, LEFT_MODE);          // Write Slider Control Value to the LCD
-        }    
+    
     
     
         if (btn1.Press())                                         // Check if btn1 button was touched and run instructions if true
@@ -131,7 +91,7 @@
             lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                        ", LEFT_MODE);
         }                                                           // End btn1 button instructions
         
-        if (test.Press())                                         // Check if test button was touched and run instructions if true
+        if (btn2.Press())                                         // Check if test button was touched and run instructions if true
         {
             lcd_.SetFont(&Font16);
             lcd_.SetTextColor(LCD_COLOR_BLACK);
@@ -142,7 +102,7 @@
             
         }                                                           // End test button instructions
         
-        if (hide.Press())                                         // Check if hide button was touched and run instructions if true
+  /*      if (hide.Press())                                         // Check if hide button was touched and run instructions if true
         {    
             lcd_.SetFont(&Font16);
             lcd_.SetTextColor(LCD_COLOR_BLACK);
@@ -155,6 +115,7 @@
             wait(0.5);
             lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                        ", LEFT_MODE);
         }                                                           // End hide button instructions
+
         
          if (show.Press())                                        // Check if hide button was touched and run instructions if true
         {  
@@ -180,7 +141,7 @@
             wait(0.5);
             lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                           ", LEFT_MODE);
         }                                                           // End 3D button instructions
- 
+*/
         wait(0.02f);   
     }                                                               // End Main program loop
 }                                                                   // End Main program