Initial commit

This commit is contained in:
mia 2025-09-18 21:29:58 +02:00
commit 413821ffe9
17 changed files with 490 additions and 0 deletions

View file

@ -0,0 +1,41 @@
/*
Rui Santos & Sara Santos - Random Nerd Tutorials
Complete project details at https://RandomNerdTutorials.com/get-change-esp32-esp8266-mac-address-arduino/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
#include <WiFi.h>
#include <esp_wifi.h>
void readMacAddress(){
uint8_t baseMac[6];
esp_err_t ret = esp_wifi_get_mac(WIFI_IF_STA, baseMac);
if (ret == ESP_OK) {
Serial.printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
baseMac[0], baseMac[1], baseMac[2],
baseMac[3], baseMac[4], baseMac[5]);
} else {
Serial.println("Failed to read MAC address");
}
}
void setup(){
pinMode(8, OUTPUT);
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.STA.begin();
Serial.print("[DEFAULT] ESP32 Board MAC Address: ");
readMacAddress();
}
void loop(){
digitalWrite(8, 1);
delay(250);
digitalWrite(8, 0);
delay(250);
Serial.print("[DEFAULT] ESP32 Board MAC Address: ");
readMacAddress();
}

View file

@ -0,0 +1,17 @@
// const int sensorPin = 2;
// bool sensorState = false;
//
// void setup() {
// pinMode(sensorPin, INPUT);
// Serial.begin(115200);
// }
//
// void loop() {
// sensorState = digitalRead(sensorPin);
// if (sensorState) {
// Serial.println("Open");
// } else {
// Serial.println("Closed");
// }
// delay(500);
// }