Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong order of displayed text #5

Open
MachmaHinne opened this issue Apr 6, 2019 · 5 comments
Open

Wrong order of displayed text #5

MachmaHinne opened this issue Apr 6, 2019 · 5 comments

Comments

@MachmaHinne
Copy link

Tried out the example for the wemos d1. But the displayed text has the wrong order.
How to reverse the order?

@cagedev
Copy link

cagedev commented Apr 25, 2019

Could you please elaborate? How did you wire and what kind of module(s) did you use?

@MachmaHinne
Copy link
Author

MachmaHinne commented May 19, 2019

Yes. Thanks for the answer.

With Wemos D1 mini (ESP8266):
CLK <-> D5/GPIO14
CS <-> D8/GPIO15
DIN <-> D7/GPIO13
https://www.banggood.com/5pcs-Geekcreit-MAX7219-Dot-Matrix-Module-4-in-1-Display-For-Arduino-p-1385313.html?cur_warehouse=CN
Used code:
import max7219
spi = machine.SPI(1, baudrate=10000000, polarity=0, phase=0)
display = max7219.Matrix8x8(spi, Pin(15), 4)
display.text('blah',0,0,1)

Btw, do you know how to use a different, denser font? I´m programming a clock and the four digits plus the colon does not fit width.
clock

@randmor
Copy link

randmor commented Jun 16, 2019

I had this problem as well when using multiple such Max7219 8x8 LED matrix display modules soldered end to end. In my code, I assemble the info I want to display into a string variable and then call a reverse() function just before I display it which will reverse the order of all the characters in the string and then display the string resulting in all the characters in proper order. Here is my reverse() function:

reverse.py.txt

And here's some code to show how to use the reverse() function:

sample_code.py.txt

I also have a demo program worth a look. It demonstrates how to scroll a longer text message across the 4-digit display from right to left showing 4 characters at a time. I'll attach that file to this message.

Max7219_ESP32_Demo.py.txt

This demo program uses a slightly modified version of the max7219 file that includes a clear() method in the Matrix8x8 class. I call this version "max7219a". Here is a copy of that file:

max7219a.py.txt

For all these files, be sure to rename the file, removing the final four characters (".txt") from the file name. Have fun with it.

@randmor
Copy link

randmor commented Jun 17, 2019

With regards to your question: "Btw, do you know how to use a different, denser font?", in the Arduino C/C++ arena, there was a guy doing a 7x5 font with Max7219 8x8 LED matrix display modules. He was using displays with large numbers of these modules and was complaining of speed issues, so I assume doing the same thing in MicroPython is going to be even worse because things are generally slower in MicroPython as compared with C/C++ (even though we are using more powerful processors). However, if your project just has 4 of these 8x8 LED matrix display modules, MicroPython might be fast enough to get reasonable results. It would be a cool feature to add to Mike Causer's max7219.py library module, but will likely involve a lot of work with translating C/C++ code into MicroPython and what not... Here are a couple of links on the topic done with Arduino C/C++ which is a good programming option for ESP8266 and ESP32 MCU boards:

https://forum.arduino.cc/index.php?topic=381530.0
https://github.com/agr00m/LedMatrixSPI/wiki
https://github.com/agr00m/LedMatrixSPI.

Looks like too big of a job for me! I'd suggest trying it with Arduino C/C++ with the ESP8266 or ESP32 Core installed and if you can get that working, maybe look at writing or translating it into a MicroPython version.

@uxhamby
Copy link

uxhamby commented May 12, 2020

Does this help?

https://xantorohara.github.io/led-matrix-editor/#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants