using the define method modified like jemington suggested
Sketch uses 82252 bytes (0%) of program storage space. Maximum is 16777216 bytes.
Global variables use 53480 bytes (19%) of dynamic memory, leaving 216856 bytes for local variables. Maximum is 270336 bytes.
using the define method with for loop using byte
Sketch uses 82252 bytes (0%) of program storage space. Maximum is 16777216 bytes.
Global variables use 53480 bytes (19%) of dynamic memory, leaving 216856 bytes for local variables. Maximum is 270336 bytes.
Using the const method with for loop uses unsigned int
Sketch uses 82252 bytes (0%) of program storage space. Maximum is 16777216 bytes.
Global variables use 53480 bytes (19%) of dynamic memory, leaving 216856 bytes for local variables. Maximum is 270336 bytes.
Using the const method with for loop iterator using byte
Sketch uses 82244 bytes (0%) of program storage space. Maximum is 16777216 bytes.
Global variables use 53480 bytes (19%) of dynamic memory, leaving 216856 bytes for local variables. Maximum is 270336 bytes.
Memory wise it didnt really matter but the const byte plus for loop byte combination was 8bytes shorter program space wise.
Does it really matter with the enormous 16.7 MB of storage, no , but it sure will be what i am going to do goinng forward as a good progrramming habbit
With your #define the value is considered to be an int. Seems you are on a 32 bit architecture, so 4 bytes will be allocated and the math will be performed using 4 bytes.
When you go for a byte type, you tell the compiler you'll only require 1 byte.
the more information you can give the compiler, the better.
➜ Strong typing helps in that regard.