Octal question

I am using the RF24network Library and the addresses are in Octal and I understand why, but how can I define the address dynamically?

One radio is sending data to another and the example shows…

RF24NetworkHeader header(011,'T');

I do not want to have to make all possible transmissions individually defined with a switch() or something. I would like to use a variable for the radioTo. If I use

int radioTo = 011;
RF24NetworkHeader header(radioTo,'T');

That gets converted to decimal 9 which is of course correct being an octal to start with but then the radio tries to send it to actual-radio-9.

How can I use Octal values in a variable?

All numbers in the computer or in the radio are binary. Octal is just one human-readable representation. You can specify any number as decimal, octal, hex or binary and it will mean the same to the radio. Octal 011 is decimal 9 or hex 0x09 – it does not matter.

jremington:
All numbers in the computer or in the radio are binary. Octal is just one human-readable representation. You can specify any number as decimal, octal, hex or binary and it will mean the same to the radio. Octal 011 is decimal 9 or hex 0x09 – it does not matter.

Or binary 1001

in a variable, in the C language (this differs by language)

Decimal 9 is binary 1001 (base 2) and binary constants cannot be coded in C within the standards. It’s rarely used.

x = 9; // decimal base 10

x = 0x9; or 0x09; // hexadecimal base 16

x = 0xFF; or 0xff; or 255; // if x is an unsigned char or unsigned int

x = 011; // octal base 8. Very rarely used these days. Dangerous to typos due to the leading 0 being the C language octal implication

x = (1<<4); //commonly used for bit(s). This means the binary 1 left-shifted 4 places.

x = (1<<CONSTANT); // commonly used where CONSTANT is #define CONSTANT 15 or some such.

Mind the differences between signed and unsigned.

time fer sum book lernin

Thanks guys,been programming for 30+ years so pretty clear on how numbers are built. But, I specifically mentioned the RF24Network as they use the octal numbers in a very specific way as Node addressing with parent, child and grandchild to ensure relaying to distant Nodes.

01 parent #1

011 first child of Parent #1

etc.

So, the format with the lading zero is significant. I stated in my OP that I understood 11 Octal = 9 Decimal, but then as I also stated, the RF24Network tries to send to Node #9 and NOT Node 011.

But moot anyway, I have set up a mapping system that sits between the Arduino program and the RF24Network.

the RF24Network tries to send to Node #9 and NOT Node 011.

Those are the same node. If it doesn't work, something else is wrong.