Demo Program
Blink LED
This basic program turns an LED connected to GPIO pin 2 ON for one second and then OFF for one second. The `setup()` function configures the LED pin as an output, while the `loop()` function keeps repeating the blink sequence forever.
blink-led.cpp
/*
* =====================================================================================
* BOARD PIN DEFINITION & FUNCTION DOCUMENTATION
* =====================================================================================
* Pin Type & Protocol Definitions:
* - UART : Universal Asynchronous Receiver-Transmitter (TX/RX serial lines for communication).
* - SPI : Serial Peripheral Interface (SCK, MOSI, MISO, CS for high-speed sensor/display buses).
* - I²C : Inter-Integrated Circuit (SDA, SCL lines for multi-device peripheral buses).
* - Digital : General Purpose Input/Output (GPIO) for binary state reading/control (HIGH/LOW).
* - PWM : Pulse Width Modulation for precise analog-like signal output (brightness, tone, speed).
* - ADC : Analog-to-Digital Converter for reading continuous analog sensor voltages.
* - Touch : Capacitive touch input sensing capability.
*
* Supported Development Board Pin Mapping / Reference (ESP32 / Advayam Core Board):
* -------------------------------------------------------------------------------------
* Pin UART SPI I²C Digital PWM ADC/Touch Function / Hardware Mapping
* -------------------------------------------------------------------------------------
* GPIO1 TX — — ✓ ✓ ADC Analog Temp Sensor / Serial TX
* GPIO3 RX — — ✓ ✓ — Serial RX
* GPIO7 — — — ✓ ✓ — 5x5 RGB Matrix Data (WS2812B)
* GPIO8 — — — ✓ — Touch Capacitive Touch Sensor Input
* GPIO10 — CS — ✓ ✓ — SPI Chip Select (LSM6DSOX IMU CS)
* GPIO11 — MOSI — ✓ ✓ — SPI MOSI (LSM6DSOX IMU Data In)
* GPIO12 — SCK — ✓ ✓ — SPI Clock (LSM6DSOX IMU Clock)
* GPIO13 — MISO — ✓ ✓ — SPI MISO (LSM6DSOX IMU Data Out)
* GPIO16 — — — ✓ ✓ — Piezo Buzzer Output
* GPIO17 — — — ✓ — — User Push Button Input (Pullup)
* GPIO18 — SCK — ✓ ✓ — SPI SCK Default Pin
* GPIO21 — — SDA ✓ — — I²C Data Pin (SDA)
* GPIO22 — — SCL ✓ — — I²C Clock Pin (SCL)
* GPIO23 — MOSI — ✓ ✓ — SPI MOSI Default Pin
* GPIO38 — — — ✓ — — LSM6DSOX IMU Interrupt Pin
* GPIO45 — — — ✓ ✓ — User Onboard LED Indicator
* -------------------------------------------------------------------------------------
*
* DEMO PROGRAM: Blink LED
* Purpose: Turns an LED connected to GPIO pin 2 ON for 1 second and OFF for 1 second continuously.
* Active Pins Used In This Code:
* - GPIO2 (LED_PIN) : Digital Output / PWM -> Onboard / External LED
* =====================================================================================
*/
#include <Arduino.h>
#define LED_PIN 2
void setup()
{
pinMode(LED_PIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}