Hello,
I’m getting quite a few strange IO errors when running the script below.
It’s a simple script; adjust the brightness of a scrolling clock according to the time of day.
clock.py
#!/usr/bin/env python
import sys
import datetime
import timeimport scrollphat
while True:
try:
now = datetime.datetime.now()
brightness = scrollphat.set_brightness(10)if now.hour >= 20 and now.hour <= 8: brightness = brightness / 2 scrollphat.write_string(time.strftime("%H:%M ")) scrollphat.scroll(1) time.sleep(0.5) except KeyboardInterrupt: scrollphat.clear() sys.exit(-1)
The script runs for a bit, then freezes.
A high number of IO Errors have occurred, please check your soldering/connections.
Traceback (most recent call last):
File “Pimoroni/scroll-phat/examples/clock.py”, line 12, in brightness = scrollphat.set_brightness(10)
File “/usr/lib/python3/dist-packages/scrollphat/init.py”, line 52, in set_brightness controller.set_brightness(brightness)
File “/usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py”, line 71, in set_brightness self.bus.write_i2c_block_data(self.i2cConstants.I2C_ADDR, self.i2cConstants.CMD_SET_BRIGHTNESS, [self.brightness])OSError: [Errno 121] Remote I/O error
The errors suggest that my soldering is to blame, which is entirely possible…
However, I’m not convinced, as it seems to be failing when passing an integer to the brightness parameter.
(Running the test-all.py script works fine and throws zero errors, which is another reason I’m not convinced it’s the soldering.)
So, I dumbed it down to just scroll the time:
clock2.py
#!/usr/bin/env python
import sys
import timeimport scrollphat
brightness = scrollphat.set_brightness(5)
while True:
try:
scrollphat.write_string(time.strftime("%H:%M "))
scrollphat.scroll(1)
time.sleep(0.5)except KeyboardInterrupt: scrollphat.clear() sys.exit(-1)
This works, no freezing, but again in the terminal window I get:
A high number of IO Errors have occurred, please check your soldering/connections.
With non of the Traceback hints.
To be fair, my python-fu is not that strong, so:
- Is my script OK?
- Should I care about IO errors in a terminal window.
Cheers,
Simon.