I have an analog light sensor working on my Micro Pro Leonardo board. I want to reach a part of my code which include keyboard presses where it monitors to see when an LED flashes and then continues the code from there.
Could someone give me a code example of how I can do that?
Currently I'd have something like....
Keyboard.write(KEY_RETURN); delay(800); Keyboard.write(KEY_TAB); delay(150); Keyboard.write(KEY_TAB); delay(150); Keyboard.write(' '); } //Code here to wait until LED flashes, registers as 30 or less on the light sensor. Then carry on with code below once this happens BootKeyboard.press(KEY_LEFT_GUI); BootKeyboard.press('r'); delay(40000); BootKeyboard.releaseAll();
I know the light sensor is
AnalogValue = analogRead(A0); and I assume it's some kind of "If" statement which loops until the value because less than what is defined but have no idea how this would be written.