Showing an image with gpio - Raspberry Pi Forums
hello guys
i've script showing picture when button connected gpio-inputs pressed.
unfortunately, doesnt work. compile command "sudo chmod +x hhh.py" make executable. after this, execute "sudo python hhh.py". terminal freezes seconds , shows lot of errors after this. i'm new python, there maybe stupid faults made. can me? image stored in same place script.
these errors:
i've script showing picture when button connected gpio-inputs pressed.
code: select all
#!/usr/bin/env python import rpi.gpio gpio pil import image im=image.open("/home/pi/rock.png").convert("rgb") buttonpin = 25 gpio.setmode(gpio.bcm) gpio.setup(buttonpin,gpio.in) while true: if ( gpio.input(25) == false ): im.show()
these errors:
code: select all
ctraceback (most recent call last): file "hhh.py", line 11, in <module> im.show() file "/usr/lib/python2.7/dist-packages/pil/image.py", line 1483, in show _show(self, title=title, command=command) file "/usr/lib/python2.7/dist-packages/pil/image.py", line 2123, in _show apply(_showxv, (image,), options) file "/usr/lib/python2.7/dist-packages/pil/image.py", line 2127, in _showxv apply(imageshow.show, (image, title), options) file "/usr/lib/python2.7/dist-packages/pil/imageshow.py", line 39, in show def show(image, title=none, **options): keyboardinterrupt
hi , welcome forum.
1 thing, not need make executable in order use command "sudo python hhh.py"
secondly, sure button connected pin software expecting react too?
show wiring diagram of switch , pi.
texy
1 thing, not need make executable in order use command "sudo python hhh.py"
secondly, sure button connected pin software expecting react too?
show wiring diagram of switch , pi.
texy
raspberrypi
Comments
Post a Comment