/* * Blink * Turns on an LED on for one second, * then off for one second, repeatedly. */ #include "Arduino.h" #include #include LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); #define PIN_RESET 2 #define PIN_CAR1 3 #define PIN_LED LED_BUILTIN typedef struct { // input pin for this car short pin; // elapsed time for pin (0 means not finished) unsigned int elapsedTime; } Car; // assume all cars are on sequential digital pins #define PIN_CAR_STARTING 3 // number of cars (4 max) #define CAR_COUNT 2 // array of cars Car cars[CAR_COUNT]; // buffer for the LCD line char buffer[40]; void setup() { Serial.begin(9600); pinMode(PIN_RESET, INPUT_PULLUP); pinMode(LED_BUILTIN, OUTPUT); // initialize each car PIN for(short i=0; i MAX_TIME) { state = STATE_DONE; displayTimers(); } } } }