Matrix11x7 readings

Hi all,

I’m having trouble getting a temperature (or any other reading) from my BME680 and sending it to the Matrix11x7 screen.

I have the following line which errors with [color=blue]“TypeError: ‘float’ object is not iterable”[/color]:

matrix11x7.write_string(sensor.data.temperature) 

I can ‘print’ the readings from the sensor OK, but I cannot find how I write the readings to the screen buffer so i can then use:

matrix11x7.show() 

…to show the results on the Matrix11x7

I’m sure this is dead simple but I can’t find a library of matrix11x7.. formats.

Any help greatly received!

Warwick

Try

if sensor.get_sensor_data(): 
        t = sensor.data.temperature 
        t = round(t)
          
matrix11x7.write_string(t) 

or

matrix11x7.write_string(%s) %(t)

@alphanumeric thank you! that worked.

…the first one :-)

Nice, and thanks for posting back what works.

I have two Pi’s with BME280’s that scroll the Day, Date, Time, Temperature, Humidity and Barometric Pressure on a Unicorn Hat HD. Also did it with a the Unicorn HD Mini and a Sense Hat. My messages change color based on the readings. Blue text for temperature if its 0c or lower for example.

I’ve also been having some fun running Enviro+ code on some Breakout garden setups. So much so that I built more permanent setups with the breakouts soldered to Proto boards. This stuff can be a lot of fun, =)

EDIT: I like mine rounded off to whole numbers. IMHO it makes the message easier to read. If you remark out the t = round(t) line you’ll get the after the decimal place bits.

excellent - next challenge is that the scroll seems to slow down appreciably over time. i’ll work that one out with coffee…

I have text in my messages, I figured out how to display a string “in” a text message.
If that display has a scroll text function it might be worth playing around with it.

text = time.strftime("It's %A %B %-d %-I:%M:%p")
displays the Day Date and Time
and
text = ("and it's %sc") % (T)
gets me “and its 22c”

1 Like