aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cores/arduino/wiring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index 1c3e5a5..b956f78 100644
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -105,11 +105,11 @@ unsigned long micros() {
void delay(unsigned long ms)
{
- uint16_t start = (uint16_t)micros();
+ uint32_t start = micros();
while (ms > 0) {
yield();
- if (((uint16_t)micros() - start) >= 1000) {
+ while ( ms > 0 && (micros() - start) >= 1000) {
ms--;
start += 1000;
}