Skip to main content

# GPIOSimulator

This Raspberry Pi emulator simulates some of the functions used in the RPi.GPIO library (using python). The intention of this library is educational.

## Installation

The easiest way is to download the zip file and extract the files in the same working environment of your script. To use the emulator just type the following at the beginning of your script.

from EmulatorGUI import GPIO

## Simulation

This library simulates the following functions which are used in the RPi.GPIO library.

GPIO.setmode() GPIO.setwarnings() GPIO.setup() GPIO.input() GPIO.output()

## Test Example

from EmulatorGUI import GPIO #import RPi.GPIO as GPIO import time import traceback

def Main():
try:

GPIO.setmode(GPIO.BCM)

GPIO.setwarnings(False)

GPIO.setup(4, GPIO.OUT) GPIO.setup(17, GPIO.OUT, initial = GPIO.LOW) GPIO.setup(18, GPIO.OUT, initial = GPIO.LOW) GPIO.setup(21, GPIO.OUT, initial = GPIO.LOW) GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_UP) GPIO.setup(15, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) GPIO.setup(26, GPIO.IN)

while(True):
if (GPIO.input(23) == False):

GPIO.output(4,GPIO.HIGH) GPIO.output(17,GPIO.HIGH) time.sleep(1)

if (GPIO.input(15) == True):

GPIO.output(18,GPIO.HIGH) GPIO.output(21,GPIO.HIGH) time.sleep(1)

if (GPIO.input(24) == True):

GPIO.output(18,GPIO.LOW) GPIO.output(21,GPIO.LOW) time.sleep(1)

if (GPIO.input(26) == True):

GPIO.output(4,GPIO.LOW) GPIO.output(17,GPIO.LOW) time.sleep(1)

except Exception as ex:

traceback.print_exc()

finally:

GPIO.cleanup() #this ensures a clean exit

Main()

## License and copyright

This library is based on work which is: (c) 2016 Roderick Vella, released under Creative Commons Attribution 4.0 International Public License It can be found in this repository at revision 69062b

All additions made after this revision are (c) 2016 Johannes Spielmann, released under AGPL-3.0+

Release files for GPIOSimulator 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GPIOSimulator 0.1
File Size Uploaded
GPIOSimulator-0.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for GPIOSimulator 0.1
File Interpreter ABI Platform
GPIOSimulator-0.1.linux-x86_64.tar.gz Details

Total release size: 15.0 kB

Release files / GPIOSimulator-0.1.tar.gz

Download URL GPIOSimulator-0.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
08a221d03c9c5bd137d573b24aa0ebb9871760b12b8a1090392cbded3d06fee8
BLAKE2b-256 checksum
How to use checksums
7cf365772749f296e3705e549eb86bffcfbcd90172ff0d48e8353e51cc99775c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / GPIOSimulator-0.1.linux-x86_64.tar.gz

Download URL GPIOSimulator-0.1.linux-x86_64.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e0043383324b6c984a256d6e56ca668b7f74571fa5602ee08013dd5a4c444314
BLAKE2b-256 checksum
How to use checksums
843fa98b521b6a71c1f34e216ebbac2f2f07a8da797caf02dccfece767a41f44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page