Algumas partes deste site ainda não estão disponíveis no seu idioma. Estamos trabalhando para corrigir isso e pedimos desculpas por qualquer inconveniente.
Lesson 14/31: Arduino Millis (no delay) and map functions | SunFounder Robojax
This lesson teaches two essential Arduino functions: millis() and map(). By the end of this tutorial, you will understand:
How to use millis() to manage timing without stopping program execution.
How to use map() to scale and control values, such as LED brightness or motor speed, based on percentages.
Part 1: Understanding millis()
The millis() function returns the number of milliseconds since the Arduino started running. It's crucial for creating non-blocking code where multiple tasks run simultaneously.
Why Use millis() Instead of delay()?
The delay() function pauses the entire program, preventing other code from running.
millis() lets you perform actions at specific intervals while the rest of your code continues executing.