All pastes #826572 Raw Edit

Anonymous

public text v1 · immutable
#826572 ·published 2007-12-21 08:02 UTC
rendered paste body
/*** 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);
}