/************************************
http://wiki.fluidnc.com/en/hardware/ESP32-S3_Pin_Reference
Default Pins
These pins are the default pins, however they can be remapped to any other gpio.
I2C
Default pins are:
gpio.9 SCL
gpio.8 SDA
There is an aditional I2C interface which does not seem
to have default pins (wip).
SPI
The ESP32 S3 has four SPI interfaces which are:
SPI0 used by ESP32-S3’s cache and Crypto DMA (EDMA) to
access in-package or off-package flash/PSRAM
SPI1 used by the CPU to access in-package or
off-package flash/PSRAM
SPI2 is a general purpose SPI controller with
its own DMA channel
SPI3 is a general purpose SPI controller with
access to a DMA channel shared between several peripherals
The SPI2 (FSPI) default pins are:
gpio.12 SCK Defined as SPI0_SCK
gpio.11 MOSI Defined as SPI0_MOSI
gpio.13 MISO Defined as SPI0_MISO
gpio.10 CSO Defined as SPI_CS0
SPI3 does not have default pin mappings because it
can be mapped to any available gpio pins.
I2S
The ESP32 S3 has two I2S interfaces which can be
mapped to any available gpio pins.
*************************************/
#include <Adafruit_NeoPixel.h>
// select the pin accorfing to microcontrol
#define PIN 38 // for esp32 s3
//#define PIN 2 //for arduino nano v3
//#define PIN 16 //for rp2040 mini
//#define PIN 18 for esp32 s2 mini
//#define PIN esp32 c mini
#define NUMPIXELS 1 // The number of LEDs in the strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(115200); // Initialize serial communication at 115200 baud rate
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Red for 15 seconds
Serial.println("Red light ON");
setColor(255, 0, 0); // Red
delay(15000); // 15 seconds delay
// Yellow for 10 seconds
Serial.println("Yellow light ON");
setColor(255, 255, 0); // Yellow
delay(10000); // 10 seconds delay
// Green for 15 seconds
Serial.println("Green light ON");
setColor(0, 255, 0); // Green
delay(15000); // 15 seconds delay
}
void setColor(uint8_t red, uint8_t green, uint8_t blue) {
strip.setPixelColor(0, strip.Color(red, green, blue));
strip.show();
}