Go Down

Topic: how to transfer variable (2) (Read 1 time) previous topic - next topic

acmilangr

becouse my english are bad, i'll try to make an example of what i want to do

#define A     {B00111100,B01000010,B01000010,B01000010,B01111110,B01000010,B01000010,B01000010}
#define B     {B01111100,B01000010,B01000010,B01111100,B01000010,B01000010,B01000010,B01111100}
#define C     {B00111110,B01000000,B01000000,B01000000,B01000000,B01000000,B01000000,B00111110}
#define D     {B01111100,B01000010,B01000010,B01000010,B01000010,B01000010,B01000010,B01111100}
#define E     {B01111110,B01000000,B01000000,B01111100,B01000000,B01000000,B01000000,B01111110}
#define F     {B01111110,B01000000,B01000000,B01111100,B01000000,B01000000,B01000000,B01000000}
#define G     {B00111100,B01000010,B01000010,B01000000,B01000111,B01000010,B01000010,B00111100}
#define H     {B01000010,B01000010,B01000010,B01111110,B01000010,B01000010,B01000010,B01000010}
#define I     {B00111000,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000,B00111000}
#define J     {B00011100,B00001000,B00001000,B00001000,B00001000,B01001000,B01001000,B00110000}
#define K     {B01000100,B01001000,B01010000,B01100000,B01010000,B01001000,B01000100,B01000010}
#define L     {B01000000,B01000000,B01000000,B01000000,B01000000,B01000000,B01000000,B01111110}
#define M     {B01000100,B10101010,B10010010,B10010010,B10000010,B10000010,B10000010,B10000010}
#define N     {B01000010,B01100010,B01010010,B01001010,B01001010,B01001010,B01000110,B01000010}
#define O     {B00111100,B01000010,B01000010,B01000010,B01000010,B01000010,B01000010,B00111100}
#define P     {B00111100,B01000010,B01000010,B01000010,B01111100,B01000000,B01000000,B01000000}
#define Q     {B00111100,B01000010,B01000010,B01000010,B01000010,B01000010,B01000110,B00111110}
#define R     {B00111100,B01000010,B01000010,B01000010,B01111100,B01000100,B01000010,B01000010}
#define S     {B00111100,B01000010,B01000000,B01000000,B00111100,B00000010,B01000010,B00111100}
#define T     {B11111110,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000}
#define U     {B01000010,B01000010,B01000010,B01000010,B01000010,B01000010,B01000010,B00111100}
#define V     {B01000010,B01000010,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000}
#define W     {B10000010,B10000010,B10000010,B10000010,B10010010,B10010010,B10101010,B01000100}
#define X     {B01000010,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B01000010}
#define Y     {B10000010,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00010000}
#define Z     {B01111110,B00000010,B00000100,B00001000,B00010000,B00100000,B01000000,B01111110}

#define pattern_1 {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define pattern_2 {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define pattern_3 {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define pattern_4 {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define pattern_5 {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define pattern_6 {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}

A,B,C,D,...Z Variables are the character patterns

pattern1,pattern2...pattern6 variables are the 6 characters that will be displayed in led display(display can display only 6 characters)

i want to transfer 6 of any A,B,C,D,E...Z varaibles  i want to patrern1,pattern2,pattern3,pattren4,pattern5,pattern6.


for example

i have these varaibles:
input1="T"
input2="H"
input3="O"
input4="M"
input5="A"
input6="S"

I want
the define pattern_1 to have the content of T varaible
the define pattern_2 to have the content of H varaible
the define pattern_3 to have the content of O varaible
the define pattern_4 to have the content of M varaible
the define pattern_5 to have the content of A varaible
the define pattern_6 to have the content of S varaible

so i can print any character i want




AlphaBeta

A few things to notice:
A...Z are not variables but definitions.
The same is true for pattern _1...6

A variable has the form:
datatype identifier = value;
For example:
int myLED = 13;

If something needs to vary at the time of running your program (at runtime) you need to use a variable. If it is a constant a #define is ok, but a const would be better (At least in my opinion)

You can try to do something like:
Code: [Select]

byte pattern_1[8] = A;
//use pattern_1 here

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up