When the adafruit library files (adafruit_gfx/RGBPanel matrix) are added to the sketch of an arduino, the fonts burnt during programming will be displayed in the Panel..
Here the method to display text is by using PROGMEM that stores the ASCII value table..
In case if i want to display the character in the 16x32 led panel from the keyboard, how am i supposed to code this logic.. ie., dynamically when i hit the keys the characters should be displayed in the LED Panel.
Please help with some programming concepts/logic/codes..
16x32 LED Matrix Panel+Dynamic Display
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 16x32 LED Matrix Panel+Dynamic Display
I haven't actually tested this, but it ought to be enough to get you started:
Code: Select all
#include <Adafruit_GFX.h> // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE 9
#define A A0
#define B A1
#define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, true);
void setup()
{
Serial.begin(9600);
matrix.begin();
matrix.setTextWrap(false); // Allow text to run off right edge
matrix.setTextSize(1);
}
#define MAX_STRING 16
char displayStr[MAX_STRING+1];
int index = 0;
void loop()
{
while (Serial.available())
{
char ch = Serial.read();
if (('/n' == ch) || (MAX_STRING == index))
{
displayStr[index] = 0; // terminate string
matrix.fillScreen(0);// Clear background
matrix.setTextColor(matrix.ColorHSV(0, 255, 255, true));
matrix.setCursor(1, 1);
matrix.print(displayStr);
index = 0; //reset display string
}
else
{
displayStr[index++] = ch; //add ch to displayStr
}
}
}
- vaish23
- Posts: 9
- Joined: Mon Dec 15, 2014 5:47 am
Re: 16x32 LED Matrix Panel+Dynamic Display
Thank you rick .. i am working on it .. Let you know in a short while..
- vaish23
- Posts: 9
- Joined: Mon Dec 15, 2014 5:47 am
Re: 16x32 LED Matrix Panel+Dynamic Display
Hi rick.,
please do help me out..
The logic is to print a string from a keyboard+ dynamically in the led panel..
Is the logic right in the code? Also i get an error "initializer required before '.' token "
Since a newbie please do not get upset with my queries.. kindly help me out..
please do help me out..
The logic is to print a string from a keyboard+ dynamically in the led panel..
Is the logic right in the code? Also i get an error "initializer required before '.' token "
Since a newbie please do not get upset with my queries.. kindly help me out..
- Attachments
-
- code.txt
- (1.6 KiB) Downloaded 153 times
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 16x32 LED Matrix Panel+Dynamic Display
Where did you get all that USB stuff from? Why do you have it? What kind of Arduino are you running on?
The code I posted earlier will take input from Serial Monitor and put it on the matrix.
The code I posted earlier will take input from Serial Monitor and put it on the matrix.
- vaish23
- Posts: 9
- Joined: Mon Dec 15, 2014 5:47 am
Re: 16x32 LED Matrix Panel+Dynamic Display
I got the usb stuff from //github (usb shield master library2.0) since the keyboard to be used will be an usb QWERTY keyboard.. The function "OnKeyDown" has got the key value ie., OemtoASCII converted key value..
- vaish23
- Posts: 9
- Joined: Mon Dec 15, 2014 5:47 am
Re: 16x32 LED Matrix Panel+Dynamic Display
I am running on Arduino Uno with a usb host shield.. The input string from usb keyboard should be displayed in the led matrix panel ..
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 16x32 LED Matrix Panel+Dynamic Display
I don't know anything about that shield or library. I can't help you with it. Sorry.
- vaish23
- Posts: 9
- Joined: Mon Dec 15, 2014 5:47 am
Re: 16x32 LED Matrix Panel+Dynamic Display
oops..!! unfortunate :-(
ok please can you help me out on coding related clarifications??
Q1) Can we pass an argument to "void loop()"??
Say suppose a get a value from a function, can that value be passed to the "void loop" of the arduino ide
ok please can you help me out on coding related clarifications??
Q1) Can we pass an argument to "void loop()"??
Say suppose a get a value from a function, can that value be passed to the "void loop" of the arduino ide
- vaish23
- Posts: 9
- Joined: Mon Dec 15, 2014 5:47 am
Re: 16x32 LED Matrix Panel+Dynamic Display
if the arguments cannot be passed to the "void loop" Then how can a function of a base class be called to the "void loop" ?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 16x32 LED Matrix Panel+Dynamic Display
You can't pass a value to void loop().
You can take your loop code and turn it into a function that takes an argument, and then call that from loop():
You can take your loop code and turn it into a function that takes an argument, and then call that from loop():
Please be positive and constructive with your questions and comments.