Tengo un pequeño problema.
Para empezar soy novato de narices, he estado buscando un poco manuales etc.. y de momento parece que no voy mal.
Para empezar he cogido el código original e intentado añadir la librería de lcd. Asta hay todo bien. El problema se surge cuando quiero ver en la segunda linea el de la pantalla el contador no se si me dejo algo.
ante todo gracias por la ayuda a un novato
#include <usb_keyboard.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(23, 22, 16, 15, 14, 13);
const int ledPin = 13; // choose the pin for the LED
int counter = 0;
int fakecounter = counter;
char pin[]="xxxx";
void setup() {
lcd.begin(16, 2);
lcd.print("Contador");
pinMode(ledPin, OUTPUT); // declare LED as output
delay(10000);
}
void loop(){
lcd.setCursor(0, 1);
keyboard_modifier_keys = 0;
if (counter <= 9999){
delay(8000);
digitalWrite(ledPin, LOW);
delay(5500);
digitalWrite(ledPin, HIGH);
sprintf(pin, "%04d", fakecounter);
//sending first digit
Keyboard.press(pin[0]);
delay(450);
Keyboard.release(pin[0]);
delay(420);
//sending second digit
Keyboard.press(pin[1]);
delay(398);
Keyboard.release(pin[1]);
delay(510);
//sending third digit
Keyboard.press(pin[2]);
delay(421);
Keyboard.release(pin[2]);
delay(423);
//sending forth digit
Keyboard.press(pin[3]);
delay(430);
Keyboard.release(pin[3]);
delay(525);
//sending enter
Keyboard.press(KEY_ENTER);
delay(305);
Keyboard.release(KEY_ENTER);
}
//reached 4 digit PIN max value
if (counter > 9999){
for (int blinkies = 0; blinkies < 8; blinkies++) {
digitalWrite(ledPin, HIGH);
delay(20);
digitalWrite(ledPin, LOW);
delay(200);
}
delay(6000);
}
++counter;
fakecounter = counter;
}