Pages: [1]   Go Down
Author Topic: define constant with two hex values, and naming arrays?  (Read 882 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 151
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6132
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

#define is just a simple text-replace macro.

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

Is equivilant to:
Code:
void loop() {
   Serial.println(0x01);
]

Logged

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

Pages: [1]   Go Up
Jump to: