LED Machine Plus is a Kotlin rewrite of LED Machine, which was written in Python.
This can be configured to poll messages from a Slack channel. Those messages control WS281x LEDs over a GPIO pin.
curl https://raw.githubusercontent.com/retrodaredevil/led-machine-plus/master/other/scripts/clone_install.sh | sudo bash
# If you need to install java:
sudo apt install openjdk-11-jdk openjdk-11-jdk-headless
First you should create a configuration.
cd program
sudo ./create_config.sh main
Configuration takes place in the program/configs/main/
directory by default.
It is recommended to use pin 12 (GPIO 18), as that is the only pin that is known to work.
If your LED strip has 4 wires (2 data wires), then you should control it using SPI. This does not require root. All SPI configurations are hardcoded to use CE0 (pin 24).
You can also use SPI with 1 data wire, but I found this to be unreliable on a Raspberry Pi. SPI is however reliable on other SBCs (I have tested SPI on an Orange Pi One and it works well)
Run sudo raspi-config
. Go to "Interface Options" and enable SPI.
./gradlew app:jar
If you want to use an Orange Pi One, connect ground to ground, and your data wire to
pin 19 (MOSI.0). When configuring, set "spi": true
. Note: pin 40 is closest to Ethernet on Orange Pi One.
You can find pinout here.
You will need to enable SPI on your Orange Pi.
- Choose directijon -- no reversing
- Use manifest file for slack setup
Useful to prefer WiFi for internet:
interface eth0
metric 300
interface wlan0
metric 200
Useful for debugging:
sudo journalctl -u led-machine-main.service -f -n100
Useful for copying jar:
./gradlew app:jar
rsync app/build/libs/app-0.0.1.jar [email protected]:/opt/led-machine-plus/program/led-machine-plus.jar
- App level token needs to have
connections:write
scope. This token will be pasted into theapp_token
property. - Enable Socket Mode
- Go to "OAuth & Permissions"
- Add
channels:history
(most important),groups:history
,im:history
, as Bot Token Scopes- Optionally add these for future use:
channels:write
,reactions:write
,reactions:read
,chat:write
,channels:read
- Optionally add these for future use:
- Install to your workspace
- Get the Bot User OAuth Token that will be pasted into the
bot_token
property.
- Add
- Go to "Event Subscriptions" and Enable Events
- Subscribe to bot events:
message.channels
,message.groups
,message.im
- Subscribe to bot events:
- Add your bot to the channel you want it to have access to
- Create application at https://discord.com/developers/applications
- Go to Bot
- Create a bot
- Create "Reset Token", confirm, and copy the newly generated token. You will need this in your configuration
- Enable "Message Content Intent"
- Go to OAuth2 > URL Generator
- Add scope "bot"
- Add permission: "Read Messages/View Channels", "Add Reactions"
- Click on the generated URL and add the application to your server
- Add scope "bot"
- Go to Bot
- Enable developer mode in your discord client
- Right-click on the channel you want to use and click "copy id".