@Richard238 wrote:
Followining on from my previous thread, I’m trying another idea to achiebe the same result.
Pi 1 hosts Enviro Phat and writes its readings to a database also on Pi 1
Pi 2 hosts Scroll PhatHD, reads data from the database on Pi 1, and displays it on Scroll Phat HD on Pi 2I’ve established all the necessary Mysql connection requirements, they’re all good.
How to I get the readings from the database on Pi1 to scroll on the Scroll PhatHD on Pi 2?
import signal import time import scrollphathd from scrollphathd.fonts import font5x7 import mysql.connector from mysql.connector import Error con = mysql.connector.connect(host='192.168.X.X',database='test',user='anon',password='####') cur = con.cursor() cur.execute('SELECT Temp FROM readings ORDER BY ID DESC LIMIT 1') rows = cur.fetchall() for row in rows: print row temperature = rows scrollphathd.set_brightness(0.1) scrollphathd.clear() str_len = scrollphathd.write_string("Temperature: %.1lC "%(temperature), x=0, y=0, font=font5x7)
(7.1,)
Above result proves the
SELECT
query is working across Pi-to-Pi, OK.Traceback (most recent call last): File "dotty2.py", line 27, in <module> str_len = scrollphathd.write_string("Temperature: %.1lC "%(temperature), x=0, y=0, font=font5x7) ValueError: unsupported format character 'C' (0x43) at index 18 ------------------ (program exited with code: 1) Press return to continue
I don’t know how to get that query result to scroll.
Thank you.
Posts: 1
Participants: 1