-
Notifications
You must be signed in to change notification settings - Fork 17
Simulate pressing a button #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Simulate press a button
Simulate press a button
Simulate press a button
If you like it, go ahead and merge. If think it is rubbish, delete it, you wont hurt my feelings. |
Please rebase this pull request.
|
""" | ||
Mock Library for RPi.GPIO | ||
""" | ||
#Mock Library for RPi.GPIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert. Docstrings will go into any automated documentation while comments will not.
class Channel: | ||
def __init__(self,channel, direction, initial=0,pull_up_down=PUD_OFF): | ||
self.channel = channel | ||
self.chanel = channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
IN = 1 | ||
LOW = 0 | ||
OUT = 0 | ||
INPUT = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input
is a Python builtin, and we already have IN
, so perhaps make this BUTTON_PRESSED or something else to make its use clearer.
Simulate input
This make it possible to simulate input to a GPIO pin, e.g. pressing a button.
echo "[PINNUMBER]:[HI|LOW]" > /dev/tcp/{host}/{port}
The port is hardcoded to 5566
example:
echo "18:LOW" > /dev/tcp/192.168.122.143/5566
For this to work you have to have python script that activate the GPIO, e.g GPIO.add_event_detect({pinnumber}, GPIO.FALLING, handle, bouncetime=1500)