ARDUINO
To display a single character using our font, Arduino has to:
[checklist]
- read the character
- substract 33 from its decimal value
- read, from aipointe_info[] array, character’s length and offset
- retrieve, from aipointe_font[] font, a number of bytes equal to its length starting from offset position
- send those bytes to the display
[/checklist]
Compared to my previous examples, I added a new function to clear the whole display sending all zeroes:
void ht1632c_clear_display() { digitalWrite(DISPLAY_CS, LOW); ht1632c_send_bits(HT1632C_WRITE, 1 << 2); ht1632c_send_bits(0x00, 1 << 6); for(int i = 0; i < 32; i++) ht1632c_send_bits(0x00, 1<<7); digitalWrite(DISPLAY_CS, HIGH); } |
The complete sketch is available on GitHub.
DEMO
I wrote a simple C# program to send on a serial port the characters with decimal value from 33 to 127, one every 250ms:
using System; using System.Collections.Generic; using System.Text; using System.IO.Ports; using System.Threading; namespace OutputDemo { class Program { static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: OutputDemo "); System.Environment.Exit(1); } SerialPort serialPort = new SerialPort(args[0], 57600); serialPort.Open(); Console.WriteLine("sending..."); for (byte i = 33; i < 127; i++) { Console.Write((char)i); serialPort.Write(new byte[] { i }, 0, 1); Thread.Sleep(250); } serialPort.Close(); Console.WriteLine("...done!"); } } } |
Here’s the sketch running:
Pages: 1 2
Hi Luca,
I have a 3208 matrix display likes yours, but when i upload the arduino’s sketch all is working well but the text display is rotated 90 degres. It’ s like the leds panels aren’t wired in the same position.
This is my 3208 led matrix:
http://fw.hardijzer.nl/?p=148
How can i modify your sketch to getting the correct position?
Thanks!
Hi Luis,
mmm it seems they rotated each matrix 90 degrees? What does it happen if you run the “static text” example (nr 3)? Could you please post a photo?
Thanks
Hi Luca!
Yes, each matrix is rotated 90 degrees.
http://imageshack.us/photo/my-images/402/20121014194624.jpg/sr=1
Thanks
Hi Luis,
mmm I wasn’t able to find any datasheets about your display to know how they connected each matrix to the controller. I’m going to send you a demo sketch via mail to do some tests…
Hi Luca, here some info about this led matrix( datasheet…)
http://fw.hardijzer.nl/?p=148.
Thanks a lot, i ‘am ready for testing.
Hi Luis,
could you try to run my first sketch: http://www.lucadentella.it/2012/10/03/matrice-di-led-con-ht1632c-2/ and write down the sequence leds turn on? So we can understand how leds are mapped to RAM cells… thanks!
Hi luca, i upgraded my fileshack library with the images, arduino UNO running your first sketch.
The order is, the first dot begins at the rightest matrix, at bottom right, and the last is the upperest left, always in horizontal direction form the right to the left. Similar for the four matrix.
Check it please
http://imageshack.us/photo/my-images/402/20121014194624.jpg/sr=1
Hi Luis,
I’ve just sent you a demo sketch for your display, let me know how it works
Thanks vor the great help ! I Try the same Projekt but i try to make 2 led Matrix with 8x 32 Leds with 16.000 mcd each red led. I want go give any Text out of my rear from my Car XD such as the German Police .
Great thanks from Germany !
Thanks Toni!
Hi Lucca thanks for your help, finally i found a compatible library in Github, otherwise i keep regarding your project 🙂
Good news, Luis!
Could you please send me the link of your library? I’ll add it in my article…
thanks
Hi Luca,
forgot to tell, yes. I’m using same matrix as Locomolo (mcu 3208 matrix clock, with atmega removed) and chars and scroll direction is rotated 90 degrees.
Searched all over github (and the rest of the internet :)) but can’t find working solution.
Hi Martin,
hope that Locomolo will send you the link to the library he found on Github because I can’t find it too… 🙁
Hello,
Currently I am working on Sure Electronics 0832 Display interfacing with PIC16F1937.
I am using SPI interface between PIC16F1937 and Display.
I am facing problem with Scrolling Message across Led display. I made 4*7 character library. Every time i am shifting 4 columns in address for displaying next char. but it overlaps.I am starting with R-L shifting but when it goes beyond 0x00 address ,it overlaps with last addresses(0x3E).
Can you please provide some guidelines for scrolling text. in C?
Hello! Give a look to my Arduino code (on Github): it’s in C. If you have any questions about it write me a comment!
hello,
i’m also having the same problem with mcu matrix but can’t find working code on github.
Could you point me in right direction?
tnx, martin
Hi Martin,
do you mean the same problem as Locomolo?
Hi Luca,
Has been googling and browsing the internet to no result of getting info about manually trigger character from switches.
Now i found your article which is the closest thing i can find related to my needs and i hope you can give me some light in the darkness.
I just need to output automatic transmission gear position (P R N D 3 2 1 O) to 5×8 led matrix.
The input will be +12v via automatic gear selector/switch (no clock generator or such, just a simple open/close switch).
Could you please help me ?
Thanks in advanced luca.
Hi Doug: how do you “know” which gear is selected? Does a single switch corrispond to a specific gear (I mean, do you have 8 switches for 8 gears)? You could monitor the status of each switch using a digital PIN of Arduino and then, with some if display the correct letter on the led matrix