Control GPIO over System Commands


I have set up Octoprint on my Prusa i3 MK3 with Camera and LED Light in an enclosure. Everythng works fine and now i would like to control the light with the Telegram App. How can I program a System Command (preferably in the System Command Editor - Plugin) to set a GPIO Pin on the Raspi High or Low? Or is this even possible? Are there any other options?
Thanks for the Help!


Controlling GPIO from a bash shell command is pretty simple:

Exports pin to userspace

echo "18" > /sys/class/gpio/export

Sets pin 18 as an output

echo "out" > /sys/class/gpio/gpio18/direction

Sets pin 18 to high

echo "1" > /sys/class/gpio/gpio18/value

Sets pin 18 to low

echo "0" > /sys/class/gpio/gpio18/value


You might try the search feature here on the forum with "gpio system commands echo /sys/class/gpio".