I plugged in a 4-relay module using a small adaptor I wired up to convert .1" spacing to .2" (2.54mm to 5.8mm) for the screw terminals on the relay module--also a DS18B20. I also used a relay-to-powerjack PCB which I had created previously:
Here's a youtube video: https://youtu.be/130S7s9zxVg
Here's the code:
Code: [Local Link Removed for Guests]
TFT.FILL 0
'Define color lookup table
dim c(24)=tft.color(BLACK),tft.color(NAVY),tft.color(DARKGREEN),tft.color(DARKCYAN),tft.color(MAROON),tft.color(PURPLE),tft.color(OLIVE),tft.color(LIGHTGREY),tft.color(DARKGREY),tft.color(BLUE),tft.color(GREEN),tft.color(CYAN),tft.color(RED),tft.color(MAGENTA),tft.color(YELLOW),tft.color(WHITE),tft.color(ORANGE),tft.color(GREENYELLOW),tft.color(PINK),tft.color(BROWN),tft.color(GOLD),tft.color(SILVER),tft.color(SKYBLUE),tft.color(VIOLET)
dim o$(2)="OFF","ON"
dim status(10)
hRes=160
vRes=128
pin6state=0
nClr=24
for i=0 to nClr-1
TFT.RECT i*hRes/nClr,0, hRes/nClr, vres, c(i), 1
next i
' end
pause 5000
TFT.FILL 0
pin.mode 9,output ' buzzer
pin.mode 5,output
pin.mode 6,output
pin.mode 7,output
pin.mode 8,output
pin(5)=0:pin(6)=0:pin(7)=0:pin(8)=0
do
p=rnd(4)+5 ' int(rnd(4)+5)
v=rnd(2)
wlog p,v
if status(p) <> v then ' a change
status(p) = v
pin(p)=v
gosub report
endif
pause 1500
loop
report:
a$=" Relay 1: "+o$(pin(5))+chr$(10): b$=" Relay 2: "+o$(pin(6))+chr$(10)
c$=" Relay 3: "+o$(pin(7))+chr$(10): d$=" Relay 4: "+o$(pin(8))
TFT.FILL 0: TFT.TEXT.POS 0,0: TFT.TEXT.SIZE 2
TFT.Print "Temp: "+tempr$(10,1)+chr$(10);a$;b$;c$;d$
return
When the ST7735 and the relay module are in use, 5 additional pins are available: 2,3,4,9, and 10. The rows of pins with red and yellow plastic provide 3V3, those with black are 0V, and the signal pins are in the middle.
I'll post the gerbers for V2 after I have made updates, including mirroring the relay port so that you can see the top of the module along with the ST7735.