By

7 thoughts on “Build Temperature & Humidity & Smoke Detector Alarm System Based on Arduino”
  1. Why use “int” for everything ?
    – use int8_t whenever your variable ranges from -127/+128 or uint8_t if ranging from 0 to 255
    – ALL arduinos do strictly have a number of pins inferior to 255, so why use int where uint8_t would PERFECTLY fit ?
    – use “int” for boolean ? Nonsense. You waste 7 bits. Use “bool” type for boolean (true/false) values.

    There’s A LOT of memory waste in that simple example. And memory is very precious on MCU. You should really optimize your code.

        1. Smallest memory storage is 8 bits long. Boolean is 8 bits- even though it is only true or false. 0 for false, 1-254 for true.

Leave a Reply

Your email address will not be published. Required fields are marked *