Byte function/variable in arduino

Hi all,

I've found a byte func./variable in arduino code that doesn't exist in C/C++ .

It's used like this:

char function(byte hexbit)
{
}

Where passed value is an hexadecimal in this form 0xVALUE . And seems to convert hexadecimal passed value to 8bit and storate in hexbit variable.

Where I can find complete code of this function(byte)?

I've found a byte func./variable in arduino code that doesn't exist in C/C++ .

byte is a type, not a function, not a variable. It DOES exist in C and C++, because there is a typedef statement buried on the Arduino header file structure that makes that name exist, based on some other standard type. Your job is to find that typedef statement. Looking for it will teach you a lot about the "behind-the-scenes" stuff you take for granted.

You use it like this

byte WhatsItWorth = byte('0xFA');
You use it like this

Code: [Select]


byte WhatsItWorth = byte('0xFA');

What the heck is that? You want to post a picture of your keyboard with that ONE character in the single quotes circled?

PaulS:

You use it like this

Code: [Select]

byte WhatsItWorth = byte('0xFA');



What the heck is that? You want to post a picture of your keyboard with that ONE character in the single quotes circled?

It's not co-incidence that I chose FA :slight_smile:

KenF:
It's not co-incidence that I chose FA :slight_smile:

But should it not be:
byte WhatsItWorth = byte(0xFA);

Otherwise 'WhatsItWorth' is actually equal to 0x41