U unsigned
I
N integer
T
8 8 bit
so what does the "t" stand for ?
U unsigned
I
N integer
T
8 8 bit
so what does the "t" stand for ?
so what does the "t" stand for ?
T-rex.
No its a typedef unsigned char, not unsigned int
Its exactly the same as a Byte, just more proper.
The _t is a naming convention often used in C code to reflect the name of a typedef.
uint8_t is one of many types that comes from the include file stdint.h which
defines some standard typedefs defined by the C standard.
There is no Byte type
Arduino did invent its own proprietary type called byte
which is a typedef for uint8_t so the Arduino proprietary type byte
is the same as uint8_t
My preference is to not use proprietary types so I avoid using byte
--- bill
so does uint8_t work as an array then? i.e.
uint8_t myTypeDef[8] {B10010111}
sensai:
so does uint8_t work as an array then? i.e.uint8_t myTypeDef[8] {B10010111}
Any type can be used to create an array of that type.
"myTypeDef" is not a typedef. It is a variable name.
(not a particularly good name for a variable)
uint8_t is the type for the variable.
The [8] says it is an array of eight elements.
So you have a variable named "myTypeDef" that is an array
of eight things that are each of type uint8_t which is an 8 bit quantity.
So your myTypeDef variable is an 8 element array of 8 bit values.
However, you only filled in one of the uint8_t 8 bit elements.
The zero'th one, all the others not provided, will be filled in as zero.
So this is what will be stored in your array:
myTypeDef[0] = B10010111 (or 0x97 in hex)
myTypeDef[1] = 0 (all 8 bits)
myTypeDef[2] = 0 (all 8 bits)
myTypeDef[3] = 0 (all 8 bits)
myTypeDef[4] = 0 (all 8 bits)
myTypeDef[5] = 0 (all 8 bits)
myTypeDef[6] = 0 (all 8 bits)
myTypeDef[7] = 0 (all 8 bits)
--- bill
Thank you so very much, you really clarified all that for me. I was kind of struggling with this to get it set right in my head, I can see the light.