Using 'Real' 1 Bit Boolean Variable For Arduino Memory Efficiency

preview_player
Показать описание
Arduino use 1 byte of memory space for each Boolean variable. Do you know that?

So for 8 booleans, 8 bytes of memory space, instead of only one byte! You can be careless about this but when you approach to the end of the medium/big size project sometimes we really need few bytes more and we go for hunting some bytes in the project. This is really happend to me, that’s why I had to find a solution to gain a little bit more memory space by hunting fat booleans who consumes 1 byte (8 bits)

With the macro, I’ve written I compress them in a space that they worth. So 8 booleans take 1 byte (8 bit) only! Means; %85 memory saving.
Рекомендации по теме
Комментарии
Автор

This is great. Thanks. Subscribed. It is nice to see the real hard core low level C guys coming up with cool solutions like this. Well done. This could really not only help a lot of projects, but enable lots of projects that would otherwise be too big for a given Arduino or other type of dev board. Using this combined with PROGMEM to store things in the flash memory act like a 1, 2 punch to eliminate memory problems. This is really fantastic.

jeffbeck
Автор

Sketch uses 50 bytes more in the right🤔

andytheodorko
visit shbcf.ru