Table of Contents
A client-server serial bus for Arduino keyboard to run scripts and activate LEDs according to them. There are a lot of Arduino keyboards instructions and manuals out there. I focused on 2 things:
- The option of running script and not just keystrokes or macros
- Feedback that also turning on and off the LEDs according to whatever you config
This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
- Of course you need to prepare your Arduino keyboard yourself. There are plenty of tutorials on the internet of how to connect LEDs and buttons to it. make sure you mark the port of each LED and button.
Note that currently the code support buttons connected to analog pins. - You must have to install Arduino IDE or similar in order to burn the .ino file to the Arduino.
- Go 16 is required to build the project, earlier versions should work too.
Arduino
- Make sure you does these changes in the .ino file before uploading:
- change analog_pins array and num_buttons
- change btn_leds array and num_leds to your corresponding used pins
- change the size of block array to the number of buttons
- change the size of timers array to the number of leds
- compile and upload
Go script
go mod vendor
#if you want to pre-compile:
go build .
conf.json fields: *after each there are examples
{
"ledBoard": {
"port": "<your PC port usually COM* in windows and /dev/ttyUSB* or /dev/ttyACM*>",
"baud": 115200
},
"buttons": {
"<.ino button array index +1>": {"cmd": "<command>"},
"2": {"cmd": "cscript //nologo C:\\Users\\mrsag\\git\\ledboard\\scripts\\toggle_zoom_audio.js"},
},
"leds": {
"<.ino led array index +1>": {
"type" : "<activate rule type: toggle/cmd[/none]>",
"toggle": {
"button": "<button number>",
"init": "<true/false>"
},
"ledCmd": {
"cmd": "<command>",
"sec": "<interval in seconds [default: 5]>",
"blink": "<set true to blink and not just on [default: false]>"
}
},
"3": {
"type" : "toggle",
"toggle": {
"init": false,
"button": 4
}
},
"4": {
"type": "cmd",
"ledCmd": {
"cmd": "C:\\Users\\mrsag\\git\\ledboard\\scripts\\check_zoom.bat",
"sec": 5,
"blink": true
}
}
}
conf.json is example configuration file for 8 button and leds and it has all of the example uses. some scripts example can be found in the script folder
- edit conf.json with the Arduino port in your computer, the button numbers (from your array, starting at 1), and the cmd and led lighting configuration.
- connect the keyboard.
- make sure the config file is in the same folder as the script (or use --conf=) and run it:
go run .
# or if you pre-compiled on windows:
./ledboard.exe
#on linux:
./ledboard
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.