I am trying to make an Arduino to type some pre programmed text, but it doesn't type anything on the target windows computer. It is known that the code is working since it is working fine on my Mac. What could cause this? I am guessing that the driver for the HID can't be found.Which could be solved by emulating the device as a known keyboard with driver already installed. The code is:
/*
Copyright (c) 2017 Seytonic, Spacehuhn (Licensed under MIT)
For more information see: github.com/seytonic/malduino
*/
#include "Keyboard.h"
#include "Mouse.h"
#define blinkInterval 50
#define ledPin 3
#define buttonPin 2
int defaultDelay = 4;
int defaultCharDelay = 5;
int rMin = 0;
int rMax = 100;
bool ledOn = true;
void typeKey(int key){
Keyboard.press(key);
delay(defaultCharDelay);
Keyboard.release(key);
}
void setup(){
pinMode(buttonPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
if(digitalRead(buttonPin) == LOW){
Keyboard.begin();
Mouse.begin();
/* ----- Begin-Script -----*/
/* [Parsed By Duckuino (Licensed under MIT) - for more information visit: https://github.com/Nurrl/Dckuino.js] */
delay(1000);
delay(defaultDelay);
Keyboard.print("Text goes here");
/* ----- End-Script -----*/
Keyboard.end();
}
}
void loop(){
ledOn = !ledOn;
digitalWrite(ledPin, ledOn);
delay(blinkInterval);
}
Edit: it is a Arduino Leonardo compatible board with the atmega32u4