Lesson 14/31: Arduino Millis (no delay) and map functions | SunFounder Robojax

All Courses
Video thumbnail for Lesson 14: Arduino Millis (no delay) and  map functions | SunFounder Robojax - RJT597

Lesson 14/31: Arduino Millis (no delay) and map functions | SunFounder Robojax

Introduction

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.

Example: Blink LED Without delay()

Comments will be displayed here.