Wireless Timing Project
ESP32 MAC Address
We will be setting up the ESP32 devices as access points. This will give the ESP32’s the ability to create their own WIFI network, which provides communication between the two devices. In order to receive two-way communication, we need to know the Media Access Control (MAC) address of one ESP32 device. There is a great tutorial, Sending Sensor Data Over Wifi, made by our very own Rob Reynolds, which goes into depth on discovering the MAC address of an ESP32. Take a look at this tutorial and follow the instructions for Step 1: Obtaining Mac Address. We are sending a trigger from the start ESP32 to the finish ESP32, you will only need to obtain the mac address for the ESP32 that you plan to use at the finish line. Here is the code Rob has created for us to find the MAC address:
/*
* MAC Address Finder
* Run this on each of your WiFi-enabled
* boards to get their MAC addresses, so
* you can plug them into your code,
* allowing your components to connect
* on power-up or after power-cycling
* without the need for any intervention!
*
* Once you've uploaded the code, open
* the Serial Monitor, hit the reset
* button on your board, and write down
* the MAC address.
* (I use a label maker to put the MAC
* address on the back of each board.)
*/
#include "WiFi.h"
void setup(){
Serial.begin(115200);
}
void loop(){
WiFi.mode(WIFI_STA);
Serial.print("The MAC address for this board is: ");
Serial.println(WiFi.macAddress());
while(1){ // This holds the loop, so it doesn't
} // print the info a million times.
}