setup:
Adafruit CircuitPython 7.2.5 on 2022-04-06; FeatherS2 with ESP32S2
I2C/SPI LCD backpack
PT 1000 amplifier
I started using the I2C bus for the LCD backpack, but it was way too slow. I switched over to the SPI bus and it was vastly improved. However, I can't get both the PT1000 amplifier and the LCD display to work at the same time.
I can get a good display up until I check the temperature, then I get garbage on the display.
I print the temperature to REPL, and the results are reasonable (room temperature until I hold the sensor, then it goes up).
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
Thanks in advance for any help.