All pastes #2045997 Raw Edit

lab1pseudocode

public text v1 · immutable
#2045997 ·published 2011-04-13 13:35 UTC
rendered paste body
while (1) {
	if (button) {
		while (button) { //when button is depressed, start timer
 			timer++;
			if (timer == 250) { var = 1; } //if sufficient time has passed, the button press is valid
		}
	}

	if (var) {
		if (!button) { //when button is released, count the press (if valid) and reset the valid indicator
			pushcount++;
			var = 0;
 		}
	}
}