WUThrust
Published © TAPR-OHL

DIY LED BEACON with ESP32-S2

A Quick Assembly Guide

IntermediateWork in progress59
DIY LED BEACON with ESP32-S2

Story

Read more

Code

Code Example

C/C++
We are incluging a sample code snippet for programming the ESP32-S2-SOLO-2-N4R2 chip, allowing control over the flashing patterns of the
high-power LED diodes and setting up a hotspot. This adaptable code ensures customization according to individual preferences.
#include <WiFi.h>

// Define the pin connected to the LED
const int ledPin = 13; // Change this to the pin you're using

const char* ssid = "Your_SSID"; // Replace with your desired SSID
const char* password = "Your_Password"; // Replace with your desired password

void setup() {
 Serial.begin(115200);

 // Set the Wi-Fi to station mode and disconnect from an AP if it was previously connected
 WiFi.mode(WIFI_AP);
 WiFi.disconnect();
 delay(100);

 // Set up the access point
 Serial.println("Setting up access point...");
 WiFi.softAP(ssid, password);

 // Print the IP address of the access point
 IPAddress IP = WiFi.softAPIP();
 Serial.print("AP IP address: ");
 Serial.println(IP);


 // Initialize the digital pin as an output
 pinMode(ledPin, OUTPUT);
}

void loop() {
 // Turn the LED on
 digitalWrite(ledPin, HIGH);
 // Wait for 500 milliseconds (half of 1 second)
 delay(500);
 // Turn the LED off
 digitalWrite(ledPin, LOW);
 // Wait for 500 milliseconds (the other half of 1 second)
 delay(500);
}

Credits

WUThrust

WUThrust

1 project • 0 followers

Comments