Unsigned Int, Mathematical operations and pitfalls in Arduino or C

Let’s consider the below code: unsigned long startTime = 1940, stopTime = 0;if( (stopTime – startTime) > 5000ul){ Serial.println(“Hello World!”);} Will this say Hello World? Yes, it will. If this sounds new or surprising to you, please continue reading below. Note the variables have been defined as unsigned long. So the result of mathematical operations… Continue reading Unsigned Int, Mathematical operations and pitfalls in Arduino or C