Go Down

Topic: define constant with two hex values, and naming arrays? (Read 1 time) previous topic - next topic

tocpcs

Can I define a constant variable with two hex values?

#define PARAM_1 0x01 0x09
#define PARAM_2 0x09 0x05

etc

And then
newSS.print(PARAM_1);

will that print 0x01 0x09 to the target ?

Then I want to name them for display on LCD - but for that I want an array:
names[PARAM_1] = 'My Disp Text';
names[PARAM_2] = 'My Next Text';
(I'd like to look at the array with the hex constant to find the name) - as names[0x01 0x09] - I know that's not going to work..) -

Any thoughts on the array?

James C4S

#define is just a simple text-replace macro.

This code:
Code: [Select]

#define something 0x01
//....
void loop() {
   Serial.println(something);
}


Is equivilant to:
Code: [Select]

void loop() {
   Serial.println(0x01);
]


Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up