0

Static text on LED matrix using Bonnet & Python
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Static text on LED matrix using Bonnet & Python

by CluelessRic on Wed Jun 02, 2021 9:29 pm

I want to display static sensor data on a 32x64 LED display with Adafruit’s bonnet and a Pi Zero, using Python.

I followed your tutorial (Adafruit RGB Matrix Bonnet for Raspberry Pi). My matrix needed an adjustment for multiplexing per Zeller's Github notes, and now I have scrolling text from the command: pi@raspberrypi:~/rpi-rgb-led-matrix/bindings/python/samples $ sudo python3 runtext.py --led-rows=32 --led-cols=32 --led-multiplexing=2 --led-chain=2 --led-gpio-mapping=adafruit-hat

But I want the sensor data displayed on the matrix to be static, and have not been able to find/adjust any Python code for this. Zeller's discourse group suggested I post my my question here.

CluelessRic
 
Posts: 6
Joined: Thu Feb 11, 2021 4:27 am

Re: Static text on LED matrix using Bonnet & Python

by adafruit_support_mike on Thu Jun 03, 2021 8:29 pm

Take a look at the code. This section is a loop that handles the scrolling:

https://github.com/hzeller/rpi-rgb-led- ... py#L21-L26

For text that stands still, just call graphics.DrawText() once.

adafruit_support_mike
 
Posts: 63059
Joined: Thu Feb 11, 2010 2:51 pm

Re: Static text on LED matrix using Bonnet & Python

by CluelessRic on Mon Jun 14, 2021 8:22 am

Thanks for your help Mike. Being a Python novice, I have not yet been able to efficiently adjust the runtext.py code to just call graphics.DrawText() once as you suggested. I think I need to keep the While loop to update the sensor variable (see below).
But by trial and error, I have managed to stop the scrolling effect in runtext.py by:
For formatting purposes only, in line 11, replacing "Hello world! with "Sea:17.7C " to get my desired sample text length for horizontal alignment for static display.
For formatting purposes only, in line 23, changing the value of 10 to 20 (for row vertical alignment on my external 32hx64w external led matrix panel).
For formatting purposes only, in line 25, changing pos -= 1 to pos -= 63 (to horizontally center/align my static text on the my matrix panel).
I now see Sea:17.7C static but blinking in the center of my matrix display. You might be shaking your head, but I consider that progress!!
If I remove line 22, being offscreen_canvas.Clear(), then the blinking stops, but I suspect that I would not be able to update the sensor variable (i.e. the text number "17.7")?

Now, I need to adjust runtext.py to also read and display a sensor variable in real time, rather than just the current sample text, presumably by editing line 11.
Could you suggest how to edit runtext.py to also display a (BS18D20 temperature sensor) variable in real time instead of a just a text field?

CluelessRic
 
Posts: 6
Joined: Thu Feb 11, 2021 4:27 am

Please be positive and constructive with your questions and comments.