3 ms·
Arduino has 16-bit int, so the timer app will work up to 32.767 or 65.535 seconds, that is less than two minutes.
by direwolf20 9mo ago
Arduino has 16-bit int, so the timer app will work up to 32.767 or 65.535 seconds, that is less than two minutes.
- 1718627440 9mo agoWhen you choose unsigned int for that type, you compare against UINT_MAX and return an EOVERFLOW, ENOMEM, EOUT_OF_RANGE or whatever you like when someone sets a timer greater than that. Or you choose another type, i.e. unsigned long which is guaranteed to take values to at least 4294967295. I happen to program for the Arduino platform recently and milliseconds in the Arduino API are typed unsigned long. If your decision is that you really want to store all 32-bit values then you use uint_least32_t or uint_fast32_t depending if you are also resource constrained.
- direwolf20 9mo agoRight, so you can't just use int.