Thonny IDE Python GPIOmock.py
Handy tool for testing Raspberry Pi Code using GPIO pins when you don’t have a Pie around.
I use this rather old script by Grant Winney on GitHub
https://github.com/grantwinney/52-Weeks-of-Pi/blob/master/GPIOmock.py
Simple to use get’s the job done.
If your developing on Windows and don’t have the RPi.GPIO package installed.
It outputs a message to the console that indicates its usage.
Copy the file into the same directory as any of the above scripts, then comment out the import Rpi.GPIO Line:
# import RPi.GPIO as GPIO
And add this line after it:
# import GPIOmock as GPIO
Shake and bake in some code, you can end up with something like this…
Showing messages in the Thonny IDE shell about whats going on with the GPIO Pins.
Which is a simple tkinter GUI for controlling a relay connected to GPIO pin 17.
When there is no RPi.GPIO package installed, I use GPIOmock to display massages
As I said very handy, just really nice to know and can save you lots of time.
cheer’s
Al