This video show my first try of GPIO Zero on raspberry Pi 2/Raspbian Jessie.
Connection (LED and Button):
Run IDLE with sudo, enter the simple code to test:
Python 2.7.9 (default, Mar 8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> from gpiozero import LED, Button
>>> led=LED(2)
>>> button=Button(3)
>>> button.when_pressed=led.on
>>> button.when_released=led.off
>>>
No comments:
Post a Comment