DISCO-F469NI_Button_and_Slider_Library v1.0

Dependencies:   BSP_DISCO_F469NI LCD_DISCO_F469NI TS_DISCO_F469NI mbed

Files at this revision

API Documentation at this revision

Comitter:
wsteenberg
Date:
Tue Sep 25 12:38:48 2018 +0000
Commit message:
DISCO-F469NI_Button_and_Slider_Library v1.0

Changed in this revision

BSP_DISCO_F469NI.lib Show annotated file Show diff for this revision Revisions of this file
F469GUI/F469GUI.cpp Show annotated file Show diff for this revision Revisions of this file
F469GUI/F469GUI.hpp Show annotated file Show diff for this revision Revisions of this file
F469GUI/F469_BUTTON.cpp Show annotated file Show diff for this revision Revisions of this file
F469GUI/F469_BUTTON.hpp Show annotated file Show diff for this revision Revisions of this file
F469GUI/F469_SLIDER.cpp Show annotated file Show diff for this revision Revisions of this file
F469GUI/F469_SLIDER.hpp Show annotated file Show diff for this revision Revisions of this file
LCD_DISCO_F469NI.lib Show annotated file Show diff for this revision Revisions of this file
TS_DISCO_F469NI.lib Show annotated file Show diff for this revision Revisions of this file
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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F469NI.lib	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/BSP_DISCO_F469NI/#3cdfcc4f7c9d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F469GUI/F469GUI.cpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,13 @@
+//-----------------------------------------------------------
+//
+//  F469_GUI
+//
+//-----------------------------------------------------------
+
+#include "F469GUI.hpp"
+
+    LCD_DISCO_F469NI GUI::lcd_;
+    TS_DISCO_F469NI GUI::ts_;
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F469GUI/F469GUI.hpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,48 @@
+/*-----------------------------------------------------------
+ * F469_GUI Library v1.0
+ * Copyright (c) 2018 Wynand Steenberg
+ * s216875730@mandela.ac.za
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *-----------------------------------------------------------
+ */
+
+#ifndef F469_GUI_HPP
+#define F469_GUI_HPP
+
+#include "mbed.h"
+#include <string>
+#include "TS_DISCO_F469NI.h"
+#include "LCD_DISCO_F469NI.h"
+
+
+    class GUI
+    {
+    public:                    
+        static LCD_DISCO_F469NI* GetLcdPtr() { return &lcd_; }
+        static TS_DISCO_F469NI* GetTsPtr() { return &ts_; }
+
+
+    protected:
+        static LCD_DISCO_F469NI lcd_;  // for LCD display
+        static TS_DISCO_F469NI ts_;    // for touch panel
+    };
+
+#endif  // F469_GUI_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F469GUI/F469_BUTTON.cpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,116 @@
+//-----------------------------------------------------------
+//
+//  F469_BUTTON class
+//
+//-----------------------------------------------------------
+
+#include "F469_BUTTON.hpp"
+
+// Draw button
+void Button::Render()
+    {
+        active_ = true;
+        
+        switch(STYLE_)
+            {
+                case 1:                                     // Style 1 - Normal button 
+                    lcd_.SetTextColor(BUTTON_COLOUR_);      // Set Textcolour to original
+                    lcd_.FillRect(ButtonX_, ButtonY_, ButtonW_, ButtonH_);  // Draw button rectangle
+                    break;
+        
+                case 2:                                     // Style 2 - 3D button
+                    lcd_.SetTextColor(LCD_COLOR_DARKGRAY);  // Set Textcolour to shadow colour
+                    lcd_.FillRect(ButtonX_+1, ButtonY_+2, (ButtonW_+3), ButtonH_+3);// Draw shadow
+                    
+                    lcd_.SetTextColor(BUTTON_COLOUR_);      // Set Textcolour to original
+                    lcd_.FillRect(ButtonX_, ButtonY_, ButtonW_, ButtonH_);  // Draw button
+                    break; 
+            }  
+             if (LABEL_.length() != 0)                        // If the label is larger than 0
+                    {
+                        lcd_.SetFont(FONTS_);
+                        lcd_.SetBackColor(BUTTON_COLOUR_);    // Set background colour
+                        lcd_.SetTextColor(LCD_COLOR_WHITE);   // Set textcolour
+
+                        uint16_t x0 = ButtonX_ + (ButtonW_ - FONT_WIDTH_*(LABEL_.length()))/2;      // Calcukate x value for Button name
+                        uint16_t y0 = ButtonY_ + (ButtonH_ - FONT_HEIGHT_)/2 + 1;                   // Calcukate y value for Button name
+                        lcd_.DisplayStringAt(x0, y0, (uint8_t *)LABEL_.c_str(),   
+                                 LEFT_MODE);                    // Write button name
+                        lcd_.SetBackColor(LCD_COLOR_WHITE);     // Set back colour
+                    }        
+    }
+    
+
+void Button::Change()   // Change colour of button when pressed
+    {
+        switch(STYLE_)
+            {
+                case 1:                                     // Style 1 - Normal button 
+                    lcd_.SetTextColor(CHANGE_COLOUR_);      // Set Textcolour to the change colour
+                    lcd_.FillRect(ButtonX_, ButtonY_, ButtonW_, ButtonH_);          // Draw button rectangle
+                    break;
+        
+                case 2:                                     // Style 2 - 3D button
+                    lcd_.SetTextColor(LCD_COLOR_WHITE);     // Set Textcolour to background colour
+                    lcd_.FillRect(ButtonX_, ButtonY_, (ButtonW_+3), ButtonH_+3);    // Clears background
+    
+                    lcd_.SetTextColor(LCD_COLOR_GRAY);      // Set Textcolour to shadow colour
+                    lcd_.FillRect(ButtonX_+1, ButtonY_+2, (ButtonW_+3), ButtonH_+3);// Draws shadow
+        
+                    lcd_.SetTextColor(CHANGE_COLOUR_);      // Indent button
+                    lcd_.FillRect((ButtonX_+6), (ButtonY_+6), (ButtonW_-3), (ButtonH_-2));  // Draw indented button
+                    break; 
+                }         
+        
+             if (LABEL_.length() != 0)            
+                    {
+                        lcd_.SetFont(FONTS_);
+                        lcd_.SetBackColor(CHANGE_COLOUR_);
+                        lcd_.SetTextColor(LCD_COLOR_BLACK);
+                        uint16_t x0 = ButtonX_ + (ButtonW_ - FONT_WIDTH_*(LABEL_.length()))/2;  // Calcukate x value for Button name
+                        uint16_t y0 = ButtonY_ + (ButtonH_ - FONT_HEIGHT_)/2 + 1;               // Calcukate y value for Button name
+                        lcd_.DisplayStringAt(x0, y0, (uint8_t *)LABEL_.c_str(),
+                                 LEFT_MODE);                // Write button name 
+                        lcd_.SetBackColor(LCD_COLOR_WHITE); // Set back colour
+                    }          
+    }
+    
+        
+
+void Button::Hide()     // Hide button
+    {
+        lcd_.SetTextColor(LCD_COLOR_WHITE);                     // Set textcolour to background colour
+        lcd_.FillRect(ButtonX_, ButtonY_, ButtonW_, ButtonH_);  // Draw rectangle in background colour     
+        active_ = false;                                        // Set active boolean to false
+    }
+      
+
+bool Button::Press()      // Check if touch detected
+    {
+        ts_.GetState(&state_);
+        if (!state_.touchDetected) return false;
+        if (!active_) return false;
+        if (!ButtonBoundaryCheck()) return false;
+        Change();           // Run the Change routine to change the colour of the button
+        wait(0.2);          // Wait to allow the colour change to be visible
+        Render();           // Draw the original button
+        return true;
+    } 
+
+bool Button::ButtonBoundaryCheck()       // Check if touch is within button boundaries
+    {
+        int nTouch = multiTouch ? state_.touchDetected : 1;
+        for (int n=0; n<nTouch; n++)
+        {
+            uint16_t x = state_.touchX[n];                  // Assign touch x pos to x
+            uint16_t y = state_.touchY[n];                  // Assign touch y pos to y
+
+            if ( (ButtonX_ <= x) && (x <= ButtonX_+ButtonW_) &&               // Check x value inside boundary
+                 (ButtonY_ <= y) && (y <= ButtonY_+ButtonH_) ) return true;   // Check y value inside boundary
+        }
+        return false;
+    }
+    
+TS_StateTypeDef Button::state_;
+bool Button::multiTouch = false;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F469GUI/F469_BUTTON.hpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,264 @@
+/*-----------------------------------------------------------
+ * F469_BUTTON Library v1.0
+ * Copyright (c) 2018 Wynand Steenberg
+ * s216875730@mandela.ac.za
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *-----------------------------------------------------------
+ */
+
+#ifndef F469_BUTTON_HPP
+#define F469_BUTTON_HPP
+
+#include "mbed.h"
+#include <string>
+#include "TS_DISCO_F469NI.h"
+#include "LCD_DISCO_F469NI.h"
+#include "F469GUI.hpp"
+
+/** A Class library for using Buttons on the DISCO-F469NI Development board.  The class
+ * uses the existing BSP class created by Team ST.
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "F469_BUTTON.hpp"
+ * 
+ * DigitalOut led_green(LED1);
+ * DigitalOut led_orange(LED2);
+ * DigitalOut led_red(LED3);
+ * DigitalOut led_blue(LED4);
+ * 
+ * TS_DISCO_F469NI ts_;
+ * LCD_DISCO_F469NI lcd_;
+ * 
+ * int main()
+ * {
+ *     led_green = 1;         // Switch off all LEDs
+ *     led_orange = 1;
+ *     led_red = 1;
+ *     led_blue = 1; 
+ * 
+ *     lcd_.Clear(LCD_COLOR_WHITE);                                        // Set LCD Background colour
+ *        
+ *     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 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 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_.SetFont(&Font16);                                                                      // Font size 16
+ *     lcd_.DisplayStringAt(5, 45, (uint8_t *)"Button example", LEFT_MODE);                        // Display secondary header text
+ * 
+ * 
+ *     while (true)                                                    // Main program loop
+ *     {
+ *         led_green = 1;                                              // Switch off all LEDs
+ *         led_orange = 1;
+ *         led_red = 1;
+ *         led_blue = 1; 
+ *     
+ *     
+ *         if (btn1.Press())                                         // Check if btn1 button was touched and run instructions if true
+ *         {    
+ *             lcd_.SetFont(&Font16);
+ *             lcd_.SetTextColor(LCD_COLOR_BLACK);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"Button1 pressed - switch on orange LED", LEFT_MODE);
+ *             led_orange = 0; 
+ *             wait(0.5); 
+ *             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
+ *         {
+ *             lcd_.SetFont(&Font16);
+ *             lcd_.SetTextColor(LCD_COLOR_BLACK);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"TEST pressed - switch on red LED", LEFT_MODE);
+ *             led_red = 0;
+ *             wait(0.5);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                        ", LEFT_MODE);
+ *             
+ *         }                                                           // End test button instructions
+ *         
+ *         if (hide.Press())                                         // Check if hide button was touched and run instructions if true
+ *         {    
+ *             lcd_.SetFont(&Font16);
+ *             lcd_.SetTextColor(LCD_COLOR_BLACK);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"Hide pressed - Hide other buttons", LEFT_MODE);
+ *             led_green = 0;
+ *             btn1.Hide();                                            // Hide btn1 button
+ *             test.Hide();                                            // Hide test button
+ *             hide.Hide();  
+ *             show.Render();
+ *             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
+ *         {  
+ *             lcd_.SetFont(&Font16);
+ *             lcd_.SetTextColor(LCD_COLOR_BLACK);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"UNHIDE pressed - Restore other buttons", LEFT_MODE);
+ *             led_blue = 0; 
+ *             wait(0.5);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                        ", LEFT_MODE);
+ *             show.Hide();                                            // Hide show button before drawing new button in same place
+ *             hide.Render();                                            // Draw hide button after hiding button in same position
+ *             btn1.Render();                                            // Draw btn1 button
+ *             test.Render();                                            // Draw test button
+ *             
+ *         }         
+ *         
+ *         if (button3D.Press())                                     // Check if 3Dbutton button was touched and run instructions if true
+ *         {    
+ *             lcd_.SetFont(&Font16);
+ *             lcd_.SetTextColor(LCD_COLOR_BLACK);
+ *             lcd_.DisplayStringAt(5, 200, (uint8_t *)"3D Button pressed - switch on blue LED", LEFT_MODE);
+ *             led_blue = 0;
+ *             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 
+ * @endcode
+ */
+
+    class Button
+    {
+    public:
+    
+        //! Constructor
+        Button(LCD_DISCO_F469NI &lcd, TS_DISCO_F469NI &ts,
+               uint16_t x, uint16_t y, uint16_t width, uint16_t height,
+               uint32_t buttonColour, uint32_t changeColour,
+               int style, const string label = "", sFONT &fonts = Font12,
+               uint32_t textColour = LCD_COLOR_WHITE)
+               : lcd_(lcd), ts_(ts), ButtonX_(x), ButtonY_(y), ButtonW_(width), ButtonH_(height),
+                 BUTTON_COLOUR_(buttonColour), CHANGE_COLOUR_(changeColour),
+                 STYLE_(style), LABEL_(label), FONTS_(&fonts), FONT_WIDTH_(fonts.Width),
+                 FONT_HEIGHT_(fonts.Height), active_(true)
+                 { Render(); }
+
+        /**
+          * @brief  Draw Button.
+          *         
+          */
+        void Render();
+        
+        /**
+          * @brief  Draw 3D Button.
+          *         
+          */
+        void Render3D();
+        
+        /**
+          * @brief  Change colour of Button.
+          *         
+          */
+        void Change();
+
+        /**
+          * @brief  Change colour of 3D Button.
+          *         
+          */
+        void Change3D();
+        
+        /**
+          * @brief  Hide Button.
+          *         
+          */
+        void Hide();
+
+        /**
+          * @brief  Check touch detected on Button.
+          *         
+          */
+        bool Press();
+        
+        /**
+          * @brief  Check if touch is on Button.
+          *         
+          */      
+        bool ButtonBoundaryCheck();
+        
+        /**
+          * @brief  Check previous state of Button.
+          *         
+          */
+        static TS_StateTypeDef GottenState()
+        {   return state_; }
+
+        /**
+          * @brief  Set or reset multi-touch.
+          *         
+          */
+        static void SetMultiTouch(bool tf) { multiTouch = tf; }
+
+
+    private:
+
+        LCD_DISCO_F469NI &lcd_;         // LCD
+        TS_DISCO_F469NI &ts_;           // Touch
+        
+        const uint16_t ButtonX_, ButtonY_, ButtonW_, ButtonH_;
+        const uint32_t BUTTON_COLOUR_;  // Original colour
+        const uint32_t CHANGE_COLOUR_;  // Colour to change to color
+        const int STYLE_;               // Button style
+        const string LABEL_;            // Button label
+        sFONT *const FONTS_;            // Button Style
+        const uint16_t FONT_WIDTH_;     
+        const uint16_t FONT_HEIGHT_;
+        bool active_;                   // Button active boolean
+        
+        static TS_StateTypeDef state_;
+        static bool multiTouch;
+
+        /**
+          * @brief  Disallow copy constructor and assignment operator.
+          *         
+          */ 
+        Button(const Button&);
+        Button& operator=(const Button&);
+        
+
+    };
+#endif  // F469_BUTTON_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F469GUI/F469_SLIDER.cpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,137 @@
+//-----------------------------------------------------------
+//
+//  F469_SLIDER class
+//
+//-----------------------------------------------------------
+
+#include "F469_SLIDER.hpp"
+
+extern uint16_t SliderDisplayValue_;
+
+// Draw Slider
+void Slider::Render()
+    {
+        active_ = true;
+        char min_[3];               //string Slider minimum;
+        char max_[3];               //string Slider maximum;
+        
+        switch(STYLE_)
+            {
+                case 1:                                     // Style 1 - Normal Slider         
+                    lcd_.SetTextColor(SLIDER_COLOUR_);                  // Slider rectangle
+                    lcd_.FillRect(SliderX_, SliderY_, SliderW_, 40);
+                    lcd_.SetTextColor(LCD_COLOR_GRAY);                  // Slider Control rectangle
+                    uint16_t xC = (SliderW_/(Max_-Min_)* valueControl_);          // Calculate initial value of Slider control
+                    lcd_.FillRect(SliderX_+xC-20, SliderY_, 40, 40);
+                    break;
+        
+                case 2:                                     // Style 2 - 3D Slider
+                    lcd_.SetTextColor(LCD_COLOR_DARKGRAY);  // Set Textcolour to shadow colour
+                    lcd_.FillRect(SliderX_+2, SliderY_+2, SliderW_+3, 40+3);    // Draws shadow                
+                    lcd_.SetTextColor(SLIDER_COLOUR_);                          // Slider rectangle
+                    lcd_.FillRect(SliderX_, SliderY_, SliderW_, 40);
+                    lcd_.SetTextColor(LCD_COLOR_GRAY);                          // Slider Control rectangle
+                    xC = (SliderW_/(Max_-Min_)* valueControl_);                           // Calculate initial value of Slider control
+                    lcd_.FillRect(SliderX_+xC-20, SliderY_, 40, 40);
+                    break; 
+            }          
+     
+        if (LABEL_.length() != 0)
+            {
+                lcd_.SetFont(FONTS_);
+                lcd_.SetBackColor(LCD_COLOR_WHITE);
+                lcd_.SetTextColor(LCD_COLOR_BLACK);
+                        
+                sprintf(min_, "%2d", (int) Min_);           // Convert minimum value to string
+                lcd_.DisplayStringAt(SliderX_, SliderY_+50, (uint8_t *)min_, LEFT_MODE);  // Display Slider minimum value
+
+                sprintf(max_, "%2d", (int) Max_);           // Convert maximum value to string
+                lcd_.DisplayStringAt((SliderX_+SliderW_-40), (SliderY_+50), (uint8_t *)max_, LEFT_MODE);  // Display Slider minimum value                        
+
+                uint16_t x0 = SliderX_ + (SliderW_ - FONT_WIDTH_*(LABEL_.length()))/2;      // Calcukate middle x value for Slider name
+                uint16_t y0 = SliderY_ + (SliderH_ - FONT_HEIGHT_)/2 + 1;                   // Calcukate y value for Slider name
+                lcd_.DisplayStringAt(x0, y0-50, (uint8_t *)LABEL_.c_str(),    
+                                 LEFT_MODE);                                        // Write Slider name
+            }        
+    }
+    
+        
+// Service Slider
+void Slider::Service()
+    {  
+        uint16_t xC_;           // X value of Control rectangle
+        uint16_t valueControl_; // Value of Slider control to display
+        
+        switch(STYLE_)
+            {
+                case 1:                                     // Style 1 - Normal button 
+                lcd_.SetTextColor(SLIDER_COLOUR_);          // Draw Slider rectangle
+                lcd_.FillRect(SliderX_, SliderY_, SliderW_, 40);
+                break;
+        
+                case 2:                                                     // Style 2 - 3D button
+                    lcd_.SetTextColor(LCD_COLOR_DARKGRAY);                  // Set Textcolour to shadow colour
+                    lcd_.FillRect(SliderX_+2, SliderY_+2, SliderW_+3, 40+3);// Draws shadow                
+                    lcd_.SetTextColor(SLIDER_COLOUR_);                      // Slider rectangle
+                    lcd_.FillRect(SliderX_, SliderY_, SliderW_, 40);
+                    lcd_.SetTextColor(LCD_COLOR_GRAY);                      // Slider Control rectangle
+                    break; 
+            }
+
+        uint16_t newX = state_.touchX[0];                       // Find new x value of touch
+             
+        if ((newX >= SliderX_) and (newX <= SliderX_+ 40))      // if touch at beginning of Slider
+            {
+                    {   xC_ = SliderX_;   }                     // Sets x value of Slider control to left x value defined for slider rectangle
+            }
+                            
+        else if ((newX >= SliderX_+SliderW_-40) and (newX <= SliderX_+ SliderW_))   // if touch at the end of Slider
+            {
+                xC_ = SliderX_+SliderW_-40;                     // Sets x value of Slider control to right x value defined for slider rectangle - width of slider control
+            }
+                            
+        else xC_ = newX - 20;                       // if touch inside Slider    
+                       
+        lcd_.SetTextColor(LCD_COLOR_YELLOW);        // Colour to change the control of the Slider when touched    
+        lcd_.FillRect(xC_, SliderY_, 40, 40);
+                        
+        valueControl_ = (newX - SliderX_) * (Max_ - Min_) / SliderW_ + Min_;      // Value to display of the control of the Slider
+        if (valueControl_== (Min_+1))valueControl_= Min_;               // Set value value to display to minimum
+        if (valueControl_== (Max_-1))valueControl_= Max_;               // Set value value to display to maximum                                              
+                        
+                        
+        lcd_.SetTextColor(LCD_COLOR_BLACK);    
+        SliderDisplayValue_ = valueControl_;
+        lcd_.SetTextColor(LCD_COLOR_YELLOW);       
+    } 
+
+
+        
+bool Slider::Moved()          // Check touch detected
+    {
+        ts_.GetState(&state_);  // Get state of touch
+        if (!state_.touchDetected) return false;
+        if (!active_) return false;
+        if (!SliderBoundaryCheck()) return false;
+        Service();              // Run Service routine
+        return SliderBoundaryCheck();
+    }
+ 
+
+bool Slider::SliderBoundaryCheck()       // Check if touch is within Slider boundaries
+    {
+        int nTouch = multiTouch ? state_.touchDetected : 1;
+        for (int n=0; n<nTouch; n++)
+        {
+            uint16_t x = state_.touchX[n];                  // Find x value of touch
+            uint16_t y = state_.touchY[n];                  // Find y value of touch
+
+            if ( (SliderX_ <= x) && (x <= SliderX_+SliderW_) &&               
+                 (SliderY_ <= y) && (y <= SliderY_+SliderH_) ) return true;   // Check if touch is within Slider defined values
+        }
+        return false;
+    }
+ 
+TS_StateTypeDef Slider::state_;
+bool Slider::multiTouch = false;    // Disable multitouch for Slider
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F469GUI/F469_SLIDER.hpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,213 @@
+/*-----------------------------------------------------------
+ * F469_SLIDER Library v1.0
+ * Copyright (c) 2018 Wynand Steenberg
+ * s216875730@mandela.ac.za
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *-----------------------------------------------------------
+ */
+
+#ifndef F469_SLIDER_HPP
+#define F469_SLIDER_HPP
+
+#include "mbed.h"
+#include <string>
+#include "TS_DISCO_F469NI.h"
+#include "LCD_DISCO_F469NI.h"
+#include "F469GUI.hpp"
+
+/** A Class library for using Sliders on the DISCO-F469NI Development board.  The class
+ * uses the existing BSP class created by Team ST.
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "F469_SLIDER.hpp"
+ * 
+ * DigitalOut led_green(LED1);
+ * DigitalOut led_orange(LED2);
+ * DigitalOut led_red(LED3);
+ * DigitalOut led_blue(LED4);
+ * 
+ * TS_DISCO_F469NI ts_;
+ * LCD_DISCO_F469NI lcd_;
+ * 
+ * 
+ * char char_SliderDisplayValue[4];    // String Value to display for the Slider Control value 
+ * uint16_t SliderDisplayValue_;       // Variable used to access Slider Control Value in F469SLIDER.cpp
+ * 
+ * int main()
+ * {
+ *     led_green = 1;         // Switch off all LEDs
+ *     led_orange = 1;
+ *     led_red = 1;
+ *     led_blue = 1; 
+ * 
+ *     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 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      
+ *        
+ *     lcd_.SetTextColor(LCD_COLOR_BLACK);                                                         // Set Text colour to Black
+ *     lcd_.SetFont(&Font20);                                                                      // Font size 20
+ *     lcd_.DisplayStringAt(5, 5, (uint8_t *)"Slider driver for DISCO_F469", LEFT_MODE);  // Display main header text
+ * 
+ *     while (true)                                                    // Main program loop
+ *     {
+ *         led_green = 1;                                              // Switch off all LEDs
+ *         led_orange = 1;
+ *         led_red = 1;
+ *         led_blue = 1; 
+ *         
+ *         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
+ *         }    
+ *  
+ *         wait(0.02f);   
+ *     }                                                               // End Main program loop
+ * }                                                                   // End Main program 
+ * @endcode
+ */
+
+    class Slider
+    {
+    public:
+        //! Constructor
+        Slider(LCD_DISCO_F469NI &lcd, TS_DISCO_F469NI &ts,
+               uint16_t x, uint16_t y, uint16_t width, uint16_t height,
+               uint16_t value_C, uint16_t min, uint16_t max,
+               uint32_t sliderColour, uint32_t changeColour,
+               int style, const string label = "", sFONT &fonts = Font12,
+               uint32_t textColour = LCD_COLOR_WHITE)
+               : lcd_(lcd), ts_(ts), SliderX_(x), SliderY_(y), SliderW_(width), SliderH_(height),
+                 valueControl_(value_C), Min_ (min), Max_ (max), 
+                 SLIDER_COLOUR_(sliderColour), CHANGE_COLOUR_(changeColour),
+                 STYLE_(style), LABEL_(label), FONTS_(&fonts), FONT_WIDTH_(fonts.Width),
+                 FONT_HEIGHT_(fonts.Height), active_(true)
+                 { Render(); }
+
+        /**
+          * @brief  Draw Slider.
+          *         
+          */
+        void Render();
+        
+        /**
+          * @brief  Service Slider.
+          *         
+          */
+        void Service();
+               
+        /**
+          * @brief  Check touch detected on Slider.
+          *         
+          */
+        bool Moved();
+   
+        /**
+          * @brief  Check if touch is on Slider.
+          *         
+          */
+        bool SliderBoundaryCheck();
+        
+        /**
+          * @brief  Check previous state of Slider.
+          *         
+          */
+        static TS_StateTypeDef GottenState()
+        {   return state_; }
+
+        /**
+          * @brief  Set or reset multi-touch.
+          *         
+          */
+        static void SetMultiTouch(bool tf) { multiTouch = tf; }
+
+                
+    private:
+        LCD_DISCO_F469NI &lcd_;
+        TS_DISCO_F469NI &ts_;
+
+        const uint16_t SliderX_, SliderY_, SliderW_, SliderH_, valueControl_, Min_, Max_;
+        const uint32_t SLIDER_COLOUR_;  // original color
+        const uint32_t CHANGE_COLOUR_;  // colour to change to color
+        const int STYLE_;               // Slider style        
+        const string LABEL_;            // Slider label
+        sFONT *const FONTS_;
+        const uint16_t FONT_WIDTH_;
+        const uint16_t FONT_HEIGHT_;
+        bool active_;                   // Slider active boolean
+        
+        static TS_StateTypeDef state_;
+        static bool multiTouch;
+
+        /**
+          * @brief  Disallow copy constructor and assignment operator.
+          *         
+          */
+        Slider(const Slider&);
+        Slider& operator=(const Slider&);
+    };
+#endif  // F469_SLIDER_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F469NI.lib	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/LCD_DISCO_F469NI/#d38374480318
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F469NI.lib	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/TS_DISCO_F469NI/#ee8fa51422c7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,186 @@
+//---------------------------------------------------------------
+//
+//  Demo program for 
+//  F469_Button and Slider library
+//
+//---------------------------------------------------------------
+#include "mbed.h"
+#include "F469_BUTTON.hpp"
+#include "F469_SLIDER.hpp"
+
+DigitalOut led_green(LED1);
+DigitalOut led_orange(LED2);
+DigitalOut led_red(LED3);
+DigitalOut led_blue(LED4);
+
+TS_DISCO_F469NI ts_;
+LCD_DISCO_F469NI lcd_;
+
+
+char char_SliderDisplayValue[4];    // String Value to display for the Slider Control value 
+uint16_t SliderDisplayValue_;       // Variable used to access Slider Control Value in F469SLIDER.cpp
+
+int main()
+{
+    led_green = 1;         // Switch off all LEDs
+    led_orange = 1;
+    led_red = 1;
+    led_blue = 1; 
+
+    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 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 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 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 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_.SetFont(&Font16);                                                                      // Font size 16
+    lcd_.DisplayStringAt(5, 45, (uint8_t *)"Button example", LEFT_MODE);                        // Display secondary header text
+
+
+    while (true)                                                    // Main program loop
+    {
+        led_green = 1;                                              // Switch off all LEDs
+        led_orange = 1;
+        led_red = 1;
+        led_blue = 1; 
+        
+
+    
+        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
+        {    
+            lcd_.SetFont(&Font16);
+            lcd_.SetTextColor(LCD_COLOR_BLACK);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"Button1 pressed - switch on orange LED", LEFT_MODE);
+            led_orange = 0; 
+            wait(0.5); 
+            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
+        {
+            lcd_.SetFont(&Font16);
+            lcd_.SetTextColor(LCD_COLOR_BLACK);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"TEST pressed - switch on red LED", LEFT_MODE);
+            led_red = 0;
+            wait(0.5);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                        ", LEFT_MODE);
+            
+        }                                                           // End test button instructions
+        
+        if (hide.Press())                                         // Check if hide button was touched and run instructions if true
+        {    
+            lcd_.SetFont(&Font16);
+            lcd_.SetTextColor(LCD_COLOR_BLACK);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"Hide pressed - Hide other buttons", LEFT_MODE);
+            led_green = 0;
+            btn1.Hide();                                            // Hide btn1 button
+            test.Hide();                                            // Hide test button
+            hide.Hide();  
+            show.Render();
+            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
+        {  
+            lcd_.SetFont(&Font16);
+            lcd_.SetTextColor(LCD_COLOR_BLACK);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"UNHIDE pressed - Restore other buttons", LEFT_MODE);
+            led_blue = 0; 
+            wait(0.5);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"                                        ", LEFT_MODE);
+            show.Hide();                                            // Hide show button before drawing new button in same place
+            hide.Render();                                            // Draw hide button after hiding button in same position
+            btn1.Render();                                            // Draw btn1 button
+            test.Render();                                            // Draw test button
+            
+        }         
+        
+        if (button3D.Press())                                     // Check if 3Dbutton button was touched and run instructions if true
+        {    
+            lcd_.SetFont(&Font16);
+            lcd_.SetTextColor(LCD_COLOR_BLACK);
+            lcd_.DisplayStringAt(5, 200, (uint8_t *)"3D Button pressed - switch on blue LED", LEFT_MODE);
+            led_blue = 0;
+            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 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Sep 25 12:38:48 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file