adafruit / Adafruit_CircuitPython_CircuitPlayground

CircuitPython library for Circuit Playground Express
MIT License
91 stars 71 forks source link

CPB temperature ZeroDivisionError #127

Closed snkYmkrct closed 6 months ago

snkYmkrct commented 6 months ago

When trying to run the circuitplayground_temperature.py example code on Circuit Playground Bluefruit, with the latest CircuitPython image, it crashes with ZeroDivisionError since the reading from the thermistor seems to be 0.

🐍BLE:Off | code.py | 9.0.2\Traceback (most recent call last):
  File "code.py", line 11, in <module>
  File "adafruit_circuitplayground/circuit_playground_base.py", line 650, in temperature
  File "adafruit_thermistor.py", line 126, in temperature
  File "adafruit_thermistor.py", line 116, in resistance
ZeroDivisionError: division by zero
]0;🐍BLE:Off | 116@adafruit_thermistor.py ZeroDivisionError | 9.0.2\
Code done running.

This bug was reported in Discord by a new user, and the light sensor only returns 0 as well.

caternuson commented 6 months ago

This is due to this issue: https://github.com/adafruit/circuitpython/issues/9109 which has been fixed: https://github.com/adafruit/circuitpython/pull/9114 and should be in the next release (after 9.0.2) of CircuitPython.

To get it working now, you'll need to revert to a pre-9.x version of CP.

Closing this since it's not an issue with this library repo.

snkYmkrct commented 6 months ago

Ah, I see... Thank you!

dhalbert commented 6 months ago

CircuitPython 9.0.3 has just been released, and has this fix.