RPLIDAR A1M8 LCD

Dependencies:   TS_DISCO_F746NG mbed BufferedSerial LCD_DISCO_F746NG mbed-rtos Trigo BSP_DISCO_F746NG

Revision:
5:734551a9f4e7
Parent:
4:0df95765b1b0
Child:
6:b6efac82e5f9
--- a/Main.cpp	Thu Nov 24 11:50:42 2016 +0000
+++ b/Main.cpp	Fri Nov 25 10:04:16 2016 +0000
@@ -11,25 +11,33 @@
 
 
 //Dichiarazione oggetti
-DigitalIn myStopButton(USER_BUTTON);
+//DigitalIn myStopButton(USER_BUTTON);
 Motor lid_Motor(PWM_OUT);
 Communication SendCommands;
 LCD_DISCO_F746NG lcd;
 TS_DISCO_F746NG ts;
+LCD_DISCO_F746NG lcd_Thread;
 
 //Dichiarazione variabili
+TS_StateTypeDef TS_State;
+
 uint16_t x, y;
 uint8_t idx;
 uint8_t start=1;
 
-void button_thread(void const *args) {
+void StopLidar_thread(void const *args) {
+    TS_DISCO_F746NG ts_Thread;
+    wait(1);
     while(true) {
-            if (myStopButton == 1) {
+            ts_Thread.GetState(&TS_State);
+              if (TS_State.touchDetected) {
                 SendCommands.Stop();
                 wait_ms(10);
                 lid_Motor.StopMotor_Scan();
                 wait_ms(10);
                 SendCommands.Reset();
+                wait_ms(10);
+                lcd_Thread.DisplayOff();
         }
      }
 }
@@ -37,7 +45,7 @@
 
 int main() {
 //  Threads start here
-    Thread button_th(button_thread);
+    Thread StopLidar__th(StopLidar_thread);
     
 //  Initialize Display
     lcd.Clear(LCD_COLOR_BLACK);
@@ -51,7 +59,7 @@
     lcd.DisplayStringAt(0, LINE(2), (uint8_t *)"D. Ruggiero 2016", RIGHT_MODE);
 
 //  Configure buttons and TFT display
-    TS_StateTypeDef TS_State;
+//    TS_StateTypeDef TS_State;
     lcd.SetTextColor(LCD_COLOR_GREEN);
     lcd.FillRect(136, 200, 200, 50);  ///Disegna bottone Verde