roughly working

This commit is contained in:
Jeff Clement 2016-02-11 18:49:25 -07:00
parent 400c607b4c
commit fcf733b05b
1 changed files with 8 additions and 14 deletions

View File

@ -12,7 +12,6 @@
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
elapsedMillis timeElapsed;
unsigned int startTime;
#define PIN_RESET 2
#define PIN_CAR1 3
@ -26,18 +25,11 @@ void setup()
pinMode(PIN_CAR1, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
startTime = timeElapsed;
Serial.println("Starting");
Serial.println(startTime);
lcd.begin(20, 4); // sixteen characters across - 2 lines
lcd.begin(20, 4);
lcd.backlight();
// first character - 1st line
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Press the button!");
}
unsigned int startTime; // start time in ms
bool tripped = false;
char buffer[40];
@ -60,17 +52,19 @@ void loop()
} else {
// if we just started, record current millis counter
if (!started) {
startTime = elapsedMillis;
startTime = timeElapsed;
started = true;
}
elapsedTime = elapsedMillis - startTime;
// calculate elapsed time in ms
elapsedTime = timeElapsed - startTime;
if (digitalRead(PIN_INPUT) == LOW && car1elapsed == 0) {
// if car1 finishes record time
if (digitalRead(PIN_CAR1) == LOW && car1elapsed == 0) {
car1elapsed = elapsedTime;
}
if (car1elapsed <> 0) {
if (car1elapsed != 0) {
// stop if all cars are complete or threshold reached
lcd.clear();
lcd.setCursor(0,0);