• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GMS 2.3+ Compiling to Raspberry Pi, control GPIOs?

Hi guys

I recently tried compiling to Raspberry Pi 4. I worked like a charm! Quite amazing, I think. Now, is there any way to being able to control the GPIO pins of the Pi from GML? That would be awesome, and that would open up GMS2 to many new possibilities.

Unfortunately, there isn't any built-in functionality for this. However, creating an extension to handle this doesn't seem like too difficult of a task. I recommend going through the manual section on extensions to see what you can do.
The Extension Editor
In particular, this section on creating your own extension: Creating An Extension

It doesn't seem like it would be too difficult to write an extension for since the Pi is very well-documented. I wish you the best!
Dude! THAT would be something! We could make our app control robots and stuff!
But seriously, I am thiinking about that from time to time, as I use custom arcade joystick in a usb chip in a Pi. I came across this thing and I'm currently thinking of a way to hack it all together (mid-long-time project) with something like this:
Simple GPIO using USB (hamvoip.org)
Thanks for the answers! However, I am not going to be able to create the extension :) Like the somewhat ill-fated GML <-> Arduino-project, maybe somebody with mad skillz will create this someday.


🍋 *lemon noises*
GMC Elder
Did some cursory googling, the GPIOs appear to be exposed as virtual files so if you can just execute Bash code (execute_shell()?) you could use that to modify them:
# Example: write "1" (high) to GPIO 23
echo 23 > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio23/value
echo 23 > /sys/class/gpio/unexport
(if you want to read/write a lot you could export all the GPIOs at the start instead of every time you want to modify them)