// This is the shared STARTER code for RTOS-A02
#include "TrafficLight.h"
#include "CrossWalkLight.h"
#include "TrafficLightController.h"
#include "GreenLightTalkingStick.h"
#include "Emergency.h"
// All LEDs are Active HIGH
// All switches are Active LOW
// Pedestrian button attached to NS traffic light means:
// 'NS needs to be RED for these pedestrians to cross'
// Vehicle detector attached to NS traffic light means:
// 'NS needs to be GREEN for these vehicles to move'
Emergency emergency(4);
TrafficLight trafficNS(25, 33, 32);
CrossWalkLight crossWalkNS(14);
TrafficLightController controllerNS("NS", trafficNS, crossWalkNS, 27, 26);
TrafficLight trafficEW(23, 22, 21);
CrossWalkLight crossWalkEW(19);
TrafficLightController controllerEW("EW", trafficEW, crossWalkEW, 17, 16);
GreenLightTalkingStick talkingStick;
void setup() {
Serial.begin(115200);
Serial.println("Traffic Light Simulation");
myTask::startAll();
}
void loop() {
// delay(1000);
// controllerNS.test();
// controllerEW.test();
// note that myTask isn't actually ran yet so we loop manually
// controllerNS.loop();
// controllerEW.loop();
// emergency.loop();
}North-South
East-West
Ped.
Ped.
Veh.
Veh.
Emergency !