Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define CODES_COUNT 1
- char* codes[CODES_COUNT] = {
- {"f24119fe", KEY_Z, Z},
- };
- const int MAX_STRING_LEN = 80;
- char stringBuffer[MAX_STRING_LEN+1];
- char* keyConfig[MAX_STRING_LEN];
- void setup() {
- Serial.begin(9600);
- for (int i = 0; i < CODES_COUNT; i++) {
- int counter = 0;
- char *str;
- char *p;
- strncpy(stringBuffer, codes[i], MAX_STRING_LEN); // copy source string
- for( str = strtok_r(stringBuffer, ",", &p); str; str = strtok_r(NULL, ",", &p)) {
- keyConfig[counter] = str;
- counter++;
- }
- }
- }
- void loop() {
- Serial.println(String(keyConfig[0]).trim());
- Serial.println(String(keyConfig[1]).trim());
- Serial.println(String(keyConfig[2]).trim());
- // Keyboard.set_key1(String(keyConfig[1]).trim());
- Keyboard.set_key1(KEY_Z);
- Keyboard.send_now();
- Keyboard.set_key1(0);
- Keyboard.send_now();
- delay(5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment