/*** shit for JDS ***/ void runTrain(void) { uint8_t count =0; DDRB |= _BV(1) | _BV(3); DDRB &= ~(_BV(2)); // honk horn PORTB |= _BV(1); Delay(500); PORTB &= ~_BV(1); // turn on train PORTB |= _BV(3); // wait for 5 laps of the train while(count < 5) { while (PINB & _BV(2)); Delay(1000); count++; } //turn off train PORTB &= ~_BV(3); }