@anitatech wrote:
Installed Piano Hat on RPi3 per website https://learn.pimoroni.com/tutorial/piano-hat/getting-started-with-piano-hat and rebooted. Basic example program (listed below) throws errors:
Traceback (most recent call last):
File "/home/pi/Documents/piano_test.py", line 1, in
import pianohat
File "/usr/lib/python3/dist-packages/pianohat.py", line 175, in
pianoctog = cap1xxx.Cap1188(i2c_addr=0x28, alert_pin=4)
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 282, in init
self.product_id = self.getproduct_id()
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 468, in getproduct_id
return self.readbyte(R_PRODUCT_ID)
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 493, in readbyte
return self.i2c.read_byte_data(self.i2c_addr, register)
OSError: [Errno 5] Input/output errorimport pianohat
import time
def handle_note(channel, pressed):
if pressed:
print ("You pressed key {}".format(channel))
else:
print ("You released key {}".format(channel))pianohat.on_note(handle_note)
while True:
time.sleep(0.001)I'm a teacher with 25 eager Python students. Please help!
Posts: 2
Participants: 2