In examples is see:
const int ledPin = 13; and
const byte ledPin = 13;
What best to use?
a second
const byte ledPin = 13;
The use of "byte" is not recommended any more and is planned to be phased out in the future.
"int" works, but uses more storage than a "byte". You can get the same effect of using "byte" by using "uint8_t" instead, which is an 8-bit unsigned integer.
If it will occurred in the future you can always define the byte with typedef with uint8_t.
So I still use byte type
Tx for the advise
Regarding memory - Most of the time it won’t matter as long as you use const in the definition
The optimizer will get rid of the variable and patch it’s value directly where it’s needed in assembly code.
If you use arrays then the story might be different depending on how you use the index
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.