Dependencies:   TextLCD MQTT

Revision:
9:f5981ced0b47
Parent:
8:c40e805eecba
Child:
10:8df624795295
--- a/main.cpp	Thu Dec 12 21:51:10 2019 +0000
+++ b/main.cpp	Thu Dec 12 22:28:02 2019 +0000
@@ -13,6 +13,8 @@
 // main() runs in its own thread in the OS
 int main() {
     Communication::init();
+    wait(5);
+    printf("starting simulation/r/n");
     // ------------------------------------------------------------------------------
     // The following three variables are used for timing statistics, do not modify them
     Timer stopwatch;    // A timer to keep track of how long the updates take, for statistics purposes
@@ -29,9 +31,7 @@
     
     int return_cars[MAX_CARS];
     
-    do {
-        Road::ready(0);
-        
+    do {        
         int new_cars = road1.try_enter_car(time);
         
         road1.let_cars_update();
@@ -73,7 +73,7 @@
         road1.publish_car_info();
         Communication::publish_road_ready();
         printf("published car info\r\n");
-        while(Road::ready(-1) == 0);       
+        road1.wait_for_sync();       
     } while( road1.active_cars > 0x00);
     
             // ----------------------------------------------------------------------