nosix / raspberry-gpio-emulator Goto Github PK
View Code? Open in Web Editor NEWRPi.GPIO emulator
License: Apache License 2.0
RPi.GPIO emulator
License: Apache License 2.0
Hi!
It seems to make the code running on Raspberry 3 B+ you should use GPIO.setmode(GPIO.BOARD) instead of GPIO.BCM. Pin 12 board pinout supports PWM.
Many thanks for the development of the project. It helps a lot if you don't have to work on the Pi all the time.
But is there a clean way, to stop the emulator and close the gui from the application and not per clicking the gui?
At this moment I have to interrupt the emulator per SIGINT or Keyboard Interrupt what leads to an error message.
Step:
import RPi.GPIO
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/RPi/GPIO.py", line 5, in
from .launcher import ui
File "/usr/local/lib/python2.7/site-packages/RPi/launcher.py", line 3, in
from .pipe import Pipe
File "/usr/local/lib/python2.7/site-packages/RPi/pipe.py", line 1, in
from builtins import bytes
ImportError: No module named builtins
========================================
使用pip install future
添加builtins的支持后
显示如下错误:
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import RPi.GPIO
Traceback (most recent call last):
File "", line 1, in
RuntimeError: not holding the import lock
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1542, in call
return self.func(*args)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 592, in callit
func(*args)
File "/usr/local/lib/python2.7/site-packages/RPi/ui_server.py", line 90, in __update
raise ex
IOError: [Errno 35] Resource temporarily unavailable
Hello nosix,
thanks for sharing this useful GPIO simulation library!
In my program I want to first setup a pin as input (High-Z), and after a game is completed set it to output LOW. This works fine with the real RPi GPIO library. But with the emulator library, this error is thrown:
Traceback (most recent call last):
File "./riddle_beer_dispenser.py", line 105, in <module>
main()
File "./riddle_beer_dispenser.py", line 92, in main
GPIO.setup(solvedPin, GPIO.OUT, initial=GPIO.LOW)
File "/home/dan/.local/lib/python3.8/site-packages/RPi/GPIO.py", line 159, in setup
__setup(__to_channel(channel), state, initial, pull_up_down)
File "/home/dan/.local/lib/python3.8/site-packages/RPi/GPIO.py", line 168, in __setup
assert channel not in __pins_dict, 'GPIO is already setup'
AssertionError: GPIO is already setup
I think it should be possible to change the pin mode once more after initial setup. Can you please fix it?
Hi!
I am using the GPIO.add_event_detect with GPIO.BOARD setting.
The emulator in the callback gives the channel number instead of the pin number.
The documentation sais it is OK, but on the hardware the default GPIO library gives the pin number in this case!
The old code:
GPIO.add_event_detect(PINS.BUTTON, GPIO.BOTH, callback=waitOnEvent)
which gives the parameter like channel.
I use the folowing workaround:
GPIO.add_event_detect(PINS.BUTTON, GPIO.BOTH, callback=lambda x: waitOnEvent(PINS.BUTTON))
which gives the parameter like pin (PINS.BUTTON)
I dont know it is a problem or not, but definitely a compatible issue...
Regards, Art
Hello, i'ad try to use it on windows 10 pro on docker stack and pip failed to install the numpy package.
I going to test with https://github.com/MomsFriendlyRobotCompany/fake_rpi
to see if i can manage RPi.GPIO emultion.
Hello, Great job !
Can we expect one day the package will be available on pypi.org?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.