 	code_idx = 0;
 }
 
+void incorrect() {
+	code_idx++;
+}
+
 void partial() {
 	code_idx++;
 }

	if (state == UNLOCKED) {
		change(LOCKED);
	}
	else {
		if (bitRead(code, size - 1 - code_idx) != bit) {
			change(LOCKED);
		}
		else {
			change(PARTIAL);
		}

		if (code_idx == size) {
			change(UNLOCKED);
		}
	}
}

	change(LOCKED);
}

bool blink_state = false;
unsigned long blink_time = 0;

State last_state = LOCKED;

void loop() {
	if (last_state != state) {
		if (state == LOCKED) {
			digitalWrite(RED_LED, LOW);
			delay(125);
			digitalWrite(RED_LED, HIGH);
			delay(125);
			digitalWrite(RED_LED, LOW);
			delay(125);
			digitalWrite(RED_LED, HIGH);
			delay(125);
			digitalWrite(RED_LED, LOW);
			delay(250);
			digitalWrite(RED_LED, HIGH);
		}

		last_state = state;
	}

	unsigned long time = millis();

	if ((state == PARTIAL || state == INCORRECT) && time > blink_time) {
		digitalWrite(RED_LED, blink_state);

		blink_state = !blink_state;
		blink_time = time + 1000;
	}

	sleep(80);
}
