LED Blink Mission Banner - Image 1
Mission Mode 1

The Light of Hope: Blink LED

STORY

Power outages make it hard for Ella to study at night. With Captain T's help and her TRIOE board, she learns to blink an LED—proving that even the smallest light can shine through darkness.

LED Blink Challenge

LED Status

LED
Mission Icon

Mission Objectives

0/6

Learn Arduino basics by defining a built-in LED at pin 2, initializing GPIO pin as output, and creating a 5 seconds blinking interval. Select "TRIOE ESP32S3 Dev Module" as the board and "COM7" as the port to upload the code.

Assigns GPIO Pin
Initialize Output Pin
Fix Delay Function
Fix Digital Write Function
Select TRIOE ESP32S3 Board
Select COM7 Port
Code Editor Icon

Loading...
Arduino Reference Icon

Arduino Reference

LED Control Commands

#define LED_BUILTIN 2

Define GPIO pin 2 as built-in LED reference

pinMode(LED_BUILTIN, OUTPUT)

Configure LED pin as output in setup()

digitalWrite(LED_BUILTIN, HIGH)

Turn LED on (apply 3.3V to pin)

digitalWrite(LED_BUILTIN, LOW)

Turn LED off (apply 0V to pin)

delay(5000)

Wait 5000 milliseconds for visible blink timing

GPIO Pin Control

pinMode(pin, OUTPUT)

Set pin as digital output (for LEDs, motors)

pinMode(pin, INPUT)

Set pin as digital input (for buttons, sensors)

pinMode(pin, INPUT_PULLUP)

Set pin as input with internal pull-up resistor

digitalRead(pin)

Read digital value from pin (HIGH or LOW)

analogWrite(pin, value)

PWM output (0-255) for LED brightness control

analogRead(pin)

Read analog value (0-1023) from pin

Program Structure

void setup()

Runs once at startup - initialize pins and settings

void loop()

Runs repeatedly after setup() - main program logic

#define CONSTANT value

Define constants (evaluated at compile time)

#include <library.h>

Include external libraries at top of code

Timing Functions

delay(milliseconds)

Pause execution for specified time in milliseconds

delayMicroseconds(microseconds)

Pause for microseconds (very short delays)

millis()

Get milliseconds since Arduino started

micros()

Get microseconds since Arduino started

Serial Communication

Serial.begin(9600)

Initialize serial communication at 9600 baud

Serial.print("text")

Send text to serial monitor

Serial.println("text")

Send text with newline to serial monitor

Serial.available()

Check if data available to read from serial

Data Types & Variables

int ledState = 0;

Integer variable (-32,768 to 32,767)

bool isBlinking = true;

Boolean variable (true or false)

unsigned long time = 0;

Large positive integer (0 to 4,294,967,295)

const int LED_PIN = 12;

Constant integer (cannot be changed)

Control Structures

if (condition)

Execute code if condition is true

else

Execute code if condition is false

while (condition)

Repeat code while condition is true

for (int i=0; i<10; i++)

Loop with counter variable

Common Constants

HIGH / LOW

Digital states: HIGH = 1 (3.3V), LOW = 0 (0V)

INPUT / OUTPUT

Pin modes for pinMode() function

true / false

Boolean values for logical operations

Serial Monitor Icon

Serial Monitor

Arduino IDE Serial Monitor - TRIOE Board Connected to COM3 at 9600 baud Waiting for code verification... Press "Verify Code" to compile and check your sketch.
LED Blink Mission