Just starting using Arduino today.
I have a Teensy programmed as a USB keyboard. Want to use pin 0 and 1 to program an F2 and F3 keystroke.
Here is my code.
void setup(){
Serial.begin(9600);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
delay(5000);
}
void loop(){
if(digitalRead(0) ==LOW)
{
Keyboard.print(KEY_F2);
while (digitalRead(0) == LOW) {
delay(10); // keep waiting until the key is released
}
}
if(digitalRead(1) ==LOW)
{
Keyboard.print(KEY_F3);
while (digitalRead(1) == LOW) {
delay(10); // keep waiting until the key is released
}
}
}
when I press the button it return the number 59 or 60.
Anyone with and ideas?
Ross