blbltheworm / yarpie

YARPie - yet another raspberry pi emulator
GNU General Public License v3.0
7 stars 1 forks source link

Output to multi GPIO throws error #4

Closed k1ngf15h3r closed 6 years ago

k1ngf15h3r commented 6 years ago

Hi, first of all I will thank you for this great emulator, which helps me to develop a RPi game without having the RPi connected all the time.

Now my problem is, that I need to switch on multiple LEDs at the same time when a button is pressed. I defined:

chan_list = [2,3,4,5,6,7,8,9,10,11,12,13]
GPIO.setup(chan_list, GPIO.OUT, initial = GPIO.LOW)
GPIO.setup(22,GPIO.IN, initial = GPIO.LOW)
...
GPIO.wait_for_edge(22, GPIO.RISING)
…
GPIO.output(chan_list, GPIO.HIGH)
time.sleep(0.5)
GPIO.output(chan_list, GPIO.LOW)

When I press button on GPIO 22 I get TypeError: 'int' object is not subscribtable which refernces to _output(channel[i], state[i])

Any idea what the error is in my code or is it something in the emu?

k1ngf15h3r commented 6 years ago

I found the issue in the init.py from the RPi_emu

I changed following line https://github.com/blbltheworm/yarpie/blob/e8fae740581525a43be6d132dbbc4d3c323ab407/python2.x/RPi_emu/GPIO/__init__.py#L97

from

_output(channel[i], state[i])

to

_output(channel[i], state)