summaryrefslogtreecommitdiff
path: root/week3/week3.ino
blob: 40519017669a395151d0ed04ad18e983eeda3a0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void setup() {
	pinMode(0, OUTPUT);
	pinMode(1, OUTPUT);
	analogReadResolution(8);
}

void loop() {
	int light = random(0, 2);
	delay(1000);
	digitalWrite(light, HIGH);
	delay(1000);
	digitalWrite(light, LOW);
	while (analogRead(A0) < 240 && analogRead(A1) < 240);
	int correct = (analogRead(A0) < 128) ^ light;
	for (int i = 0; i < 4; ++i) {
		digitalWrite(correct, HIGH);
		delay(200);
		digitalWrite(correct, LOW);
		delay(200);
	}
}