So i wrote this code with some help, what i cant figure out is how to make, say "x" be written 3 times with 1 click of a single button? Im using adrino Leonardo with this and toggle switches. If anyone knows how to add something to make it write 3 letters with 1 button(I only want x to be written 3 times, everything else i want to be written once, Thanks.
Heres the code i used
#include "Keyboard.h"
boolean states[] = {false, false, false, false, false, false, false, false, false, false, false, false,
false, false};
char hotkeysOn[] = {'g', 'c', 'q', 'a', 'b', 'w', 'd', 'l', 's', 'j', 'k', 'm', 'x', 'z'};
char hotkeysOff[] = {'g', 'c', 'q', 'a', 'b', 'w', 'd', 'l', 's', 'j', 'k', 'n', 'x', 'z'};
void setup() {
for (int i = 0; i <= 13; i++) {
pinMode(i, INPUT);
}
Keyboard.begin();
Serial.begin(9600);
}
void loop() {
for (int i = 0; i <= 0; i++) {
if (digitalRead(i) == HIGH && !states[i]) {
states[i] = !states[i];
Keyboard.write(hotkeysOn[i]);
}
else if (digitalRead(i) == LOW && states[i]) {
states[i] = !states[i];
Keyboard.write(hotkeysOff[i]);
}
}
delay(10);
}