lupiana:
Hi patduino,
your solution don't work.
His solution did what you said it should do, but what you said was not what you wanted. This is not the same thing as Patduinos's sketch not working.
lupiana:
I want to turn on 3 LEDs and after each with delay (1000) bring it back to LOW and turn on the next. When the first LED is HIGH want to send to the PC the number "1", when the second LED is HIGH want to send to the PC the number "2", When the third LED is HIGH want to send to the PC the number "0".
I'll assume your LEDs are on pins 13,12, and 11.
void loop() {
turn_on_a_LED_and_send_a_key(13, "1");
turn_on_a_LED_and_send_a_key(12, "2");
turn_on_a_LED_and_send_a_key(11, "0");
}
void turn_on_a_LED_and_send_a_key(byte LED, char * KEY) {
digitalWrite(LED, HIGH);
Keyboard.press(KEY);
delay(1000);
digitalWrite(LED, LOW);
}