Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:150dd9f9c0f1
- Parent:
- 1:54512aca944d
- Child:
- 3:aa2778d92301
--- a/main.cpp Mon Nov 11 00:50:05 2019 +0000
+++ b/main.cpp Mon Nov 11 01:03:46 2019 +0000
@@ -37,25 +37,28 @@
int new_cars2 = road2->try_enter_car(time);
road1->let_cars_update();
+ road2->let_cars_update();
road1->wait_for_car_update();
+ road2->wait_for_car_update();
printf("\r\nRoad 1 Update %d\r\n", time);
road1->print_status();
printf("\r\nRoad 2 Update %d\r\n", time);
road2->print_status();
-
+
+ lcd.cls();
if(new_cars1 == -1 && (intersection.intersection_car == -1 || intersection.intersection_car > 4)){
- lcd.printf("x, x");
+ lcd.printf("x, x\n");
}
else if(new_cars1 != -1 && (intersection.intersection_car == -1 || intersection.intersection_car > 4)){
- lcd.printf("%d, x", new_cars1);
+ lcd.printf("%d, x\n", new_cars1);
}
else if(new_cars1 == -1 && !(intersection.intersection_car == -1 || intersection.intersection_car > 4)){
- lcd.printf("x, %d", intersection.intersection_car);
+ lcd.printf("x, %d\n", intersection.intersection_car);
}
else{
- lcd.printf("%d, %d", new_cars1, intersection.intersection_car);
+ lcd.printf("%d, %d\n", new_cars1, intersection.intersection_car);
}
if(new_cars2 == -1 && intersection.intersection_car < 5){
@@ -82,10 +85,7 @@
numberCycles++;
stopwatch.reset();
// ------------------------------------------------------------------
-
- lcd.cls();
- //lcd.printf("1 %d -> %d\n2 %d -> %d", 0,0,car2.position, car2.speed);
-
+
} while( road1->active_cars > 0x00 || road2->active_cars > 0x00);
// ----------------------------------------------------------------------
