ugnen

git clone https://git.tarina.org/ugnen
Log | Files | Refs

commit 5598d9695c6841bbecdab728e2360be7ca42631f
parent c4d7b388c39f52e5ebdb91feed1d77e0b6af5724
Author: rbckman <rob@tarina.org>
Date:   Thu,  8 Sep 2022 11:24:39 +0300

read temperature with raspberry

Diffstat:
Mugnen.py | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/ugnen.py b/ugnen.py @@ -5,8 +5,16 @@ import requests import socket import os import pickle -import serial +#import serial import blessed +import max6675 + +# set the pin for communicate with MAX6675 +cs = 22 +sck = 18 +so = 16 +# max6675.set_pin(CS, SCK, SO, unit) [unit : 0 - raw, 1 - Celsius, 2 - Fahrenheit] +max6675.set_pin(cs, sck, so, 1) term = blessed.Terminal() @@ -40,14 +48,15 @@ GPIO.setup(relaypin, GPIO.OUT) #RELAY GPIO.output(relaypin, GPIO.LOW) -try: - arduino = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=.1) -except: - arduino = '' +#try: +# arduino = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=.1) +#except: +# arduino = '' def read_temp(): try: - temp = arduino.readline().decode('utf-8').rstrip() + temp = max6675.read_temp(cs) + #temp = arduino.readline().decode('utf-8').rstrip() except: return 0 return temp