Adafruit CircuitPython 7.2.5 on 2022-04-06; FeatherS2 with ESP32S2
I2C/SPI LCD backpack
PT 1000 amplifier
Code: Select all
import gc
import sys
import time
import board
import digitalio
import busio
import adafruit_max31865
import adafruit_character_lcd.character_lcd_spi as character_lcd
def display(string):
lcd.clear()
lcd.message = string
lcd_columns = 20
lcd_rows = 5
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
latch = digitalio.DigitalInOut(board.D5)
lcd = character_lcd.Character_LCD_SPI(spi, latch, lcd_columns,
lcd_rows)
spi = busio.SPI(board.SCK, MOSI=board.MOSI,MISO=board.MISO)
cs = digitalio.DigitalInOut(board.D9)
adafruit_max31865.MAX31865(spi, cs, wires=3,
rtd_nominal=1000.0, ref_resistor=4300.0)
lcd.backlight = True
lcd.clear()
def temp():
try:
t= temperature * 9 / 5 + 32
return(int(t))
except:
return(0)
currentTemp = 22
setTemp = 55
while True:
previousTemp = currentTemp
currentTemp = sensor1.temp()
currentTemp = 55
display("%d / %d" % (round(currentTemp), round(setTemp)))
time.sleep(5)
setTemp += 1
code.py output:
Traceback (most recent call last):
File "code.py", line 20, in <module>
ValueError: IO36 in use
If I have only the LCD or only the PT1000 in the code, it runs. If I have both, no mater the order, whichever comes second throws the error.
What am I doing wrong?