I’m currently working on a project where I am attempting to read a CSV log from an SD card and interpret it into keyboard and mouse commands using the Keyboard and Mouse libraries for the Arduino Leonardo.
Currently, the sketch plays through all the commands, but the timing seems to drift. If I look at the playback from the serial monitor, I see pauses every so often. I’ve tried monitoring the RAM usage at the same time, and it doesnt appear to be filling, so that leads me to believe it’s some sort of bandwidth issue with the SPI interface on the Arduino.
Here’s the sketch I am using to play the logs back, and a sample log itself.
https://github.com/addisokw/ArduinoHIDPlayback/blob/master/keyboard_playback/keyboard_playback.ino
https://github.com/addisokw/ArduinoHIDPlayback/blob/master/bioshock/combined_log_bioshock.csv
A bit of context to the arbitrary log file format I’m using:
Column 1 is the time which the action occurs,
Column 2 is 0/1//2 to determine whether it is a keyboard command, a mouse movement command, or a mouse click
Column 3 is either mouse X / ascii for a keyboard command / or the mouse button to be pressed (depending on the second field),
Column 4 is either mouse y, key up or down (0,1), or mouse up/down (0,1)