rongyu lou / Mbed OS CarPakingSystem_V13

Dependencies:   HCSR04new SSH1106-alan

Revision:
3:17acfeba3730
Parent:
2:1baa0bd2fde0
--- a/Thread/Thread_Handle.cpp	Mon Mar 08 02:43:03 2021 +0000
+++ b/Thread/Thread_Handle.cpp	Mon Apr 19 10:10:35 2021 +0000
@@ -12,6 +12,28 @@
 Thread RTC_thread;
 Thread sensor_capture_thread;
 Thread oled_thread;
+Thread time_thread;
+//Thread realTime_thread;
+
+int Q=1;
+//void time_record_thread(void)
+//{
+//    while(true) {
+//          ssh1106.writeTim_format(10,6, font_5x8,p_tm->tm_hour);
+//          ssh1106.writeTim_format(60,6, font_5x8,p_tm->tm_min);
+//          ssh1106.writeTim_format(120,6, font_5x8,p_tm->tm_sec);
+//        thread_sleep_for(1000);
+//    } 
+//    
+//}
+void time_check_thread(void)
+{    
+    while(true) {
+        Q++;
+        //printf("%d \n\n",Q);
+        thread_sleep_for(1000);
+    } 
+}
 
 //Usensor dist 0-- blue line
 void dist0_thread(void)
@@ -32,11 +54,18 @@
     }
 }
 //Display car number 
+
 void OLED_refresh_thread()
 {
+    int n=1;
+    char str[40];
     while(true) {
         ssh1106.writeText_format(0,1, font_5x8,"Car num:");
-        ssh1106.writeDec_format(55,1, font_5x8,carNum  );
+        ssh1106.writeDec_format(55,1, font_5x8,carNum  );   
+        n = sprintf(str, "%d",Q);   
+        ssh1106.writeText(0,6, font_5x8,str,n);
+
+        
         oled_carStateDisplay();
         thread_sleep_for(1);
     }
@@ -76,7 +105,8 @@
         thread_sleep_for(100);
         ssh1106.clear();
         oled_thread.start(OLED_refresh_thread);
-
+        time_thread.start(time_check_thread);
+        //realTime_thread.start(time_record_thread);
         //RTC
         RTC_INIT();
         RTC_thread.start(RTC_display_thread);