Hello,
New to Arduino. I'm trying to learn how to control the display on the LED. I followed the instructions on https://learn.adafruit.com/adafruit-led ... 8x8-matrix and got it to start displaying a bunch of displays, but how to I create my own display? For example, how can I make the led matrix spell: M - delay (10 secs) - U - delay (10 secs) - J - delay (10 secs) - I - delay (10 secs) - B - delay (10 secs)? Some direction to tutorials would be helpful. I don't see any video tutorials online, so if I learn this properly, I'll look into making some myself.
Thanks,
Syed
Help with 1.2" 8x8 Matrix
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- SeiRruf
- Posts: 82
- Joined: Thu Sep 04, 2014 3:07 am
Re: Help with 1.2" 8x8 Matrix
Hello Durlov, and welcome to the Adafruit forums!
LED Matrix are the best, I have a few, but haven't been able to get any of the ones from Adafruit recently, so I am not 100% familiar with the code structure for them. However, I spent some time to look it over and not surprisingly, it was pretty simple. Most Adafruit libraries are!
I wrote some sample code for you that technically *should* do what you described. I kept it well commented so you can follow along and change it as you'd desire. It's yours to keep, modify & learn from. Just copy/paste it into a new sketch and Upload!
LED Matrix are the best, I have a few, but haven't been able to get any of the ones from Adafruit recently, so I am not 100% familiar with the code structure for them. However, I spent some time to look it over and not surprisingly, it was pretty simple. Most Adafruit libraries are!
I wrote some sample code for you that technically *should* do what you described. I kept it well commented so you can follow along and change it as you'd desire. It's yours to keep, modify & learn from. Just copy/paste it into a new sketch and Upload!
Code: Select all
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
char myMsg[] = "MUJIB"; //YOU CHANGE THIS IF DESIRED
void setup ()
{
//start Serial for debugging
Serial.begin ( 9600 );
Serial.println ( "8x8 Matrix Text! Sample code by SeiRruf (untested)" );
//address the display we're writing to
matrix.begin ( 0x70 );
//text size, probably should be left at 1, not sure (I don't have this display)
//matrix.setTextSize(1);
//i am not 100% sure what this does, but I think it makes it so the text does or doesn't repeat at the edges
matrix.setTextWrap ( false );
//let the matrix know we're lighting up the following letters
matrix.setTextColor ( LED_ON );
//if you want to rotate the letter, be my guest
matrix.setRotation ( 0 ); // 0 = right side up
//position start pixel to x,y -> 0,0;
matrix.setCursor ( 0, 0 );
}
void loop ()
{
for ( int i = 0; i < sizeof(myMsg) - 1; i++ ) { //for each character in the message given,
matrix.clear (); //clear display for next coming letter
matrix.print ( myMsg[i] ); //write next letter to memory
Serial.println ( myMsg[i] ); //debug, send the message to console as well
matrix.writeDisplay (); //push memory to LED matrix
delay ( 10000 ); //10 seconds delay
}
}
Last edited by SeiRruf on Sat Sep 20, 2014 6:25 pm, edited 1 time in total.
- Durlov
- Posts: 3
- Joined: Fri Sep 19, 2014 9:07 pm
Re: Help with 1.2" 8x8 Matrix
Thanks, SeiRruf. Your code is very well commented! I'll try it out and let you know how it goes.
- Durlov
- Posts: 3
- Joined: Fri Sep 19, 2014 9:07 pm
Re: Help with 1.2" 8x8 Matrix
Hey SeiRruf, the code doesn't seem to be working. I just copy pasted what you put on the website into a new sketch. The LED matrix just went blank.
- SeiRruf
- Posts: 82
- Joined: Thu Sep 04, 2014 3:07 am
Re: Help with 1.2" 8x8 Matrix
I went ahead and updated the code in my original post. Try it again?Durlov wrote:Hey SeiRruf, the code doesn't seem to be working. I just copy pasted what you put on the website into a new sketch. The LED matrix just went blank.
It is using all the same variables as the 8x8 matrix example included with the library, but I do not have an LED matrix to test it with.
I added Serial to it, so after uploading the new code, check your arduino's console on BAUD 9600, it should display the letters as they "should" be showing on the matrix.
I am curious with this too, as I will be getting a matrix within a month, and am trying to learn about these backpacked ones as well.
Please be positive and constructive with your questions and comments.