OPTION.MAC in ESP32

Here we can discuss about the problem found
Post Reply
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

OPTION.MAC in ESP32

Post by Fernando Perez »

On an ESP8266 I record this program:

Code: [Local Link Removed for Guests]

' Receptor
OPTION.MAC "AA:BB:CC:DD:EE:F1"
espnow.begin
onEspNowMsg message
wait

message:
  print "Received message: " + espnow.read$ 
return
On another ESP8266 I record this one:

Code: [Local Link Removed for Guests]

' Emisor
espnow.begin
espnow.add_peer "AA:BB:CC:DD:EE:F1"
timer0 10000, sendMessage
wait
END

sendMessage:
  msg$ = date$ + " " + time$ + " " + str$(rnd(1001))
  print "Sent message: " + msg$ 
  espnow.write msg$
return
In both modules, I leave the entire configuration page blank, except for the autorun, the AP name and the "Protected Access" data.

As always, I marvel at how Annex can achieve so much in so few lines. It works perfectly. For hours and days.

But if I try to do the same with an ESP32, on the receiving side I get the warning through the serial port:

Switched to AP Mode Vozpornoche
IP address: 192.168.4.1
Number of program lines: 9
Basic File Loaded: /receptor.bas
Program Running
Invalid MAC address line 2
Program Ended


My questions: Does the OPTION.MAC instruction not work on the ESP32?
Is it written differently than on the ESP8266?
User avatar
cicciocb
Site Admin
Posts: 2059
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: OPTION.MAC in ESP32

Post by cicciocb »

HI Fernando,
The name of your WiFi access point is always a bit disconcerting as it hide an ambiguous word within it... :lol:

There is probably an error in the command, I've just checked with WOKWI and the MAC address changes (and the module disconnects as expected) but there is an error message; you can check just with
print MAC$
after the command. You can skip the error message, I'll try to see why it happens.
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

Re: OPTION.MAC in ESP32

Post by Fernando Perez »

Vozpornoche is a town of 8 residents. In Cantabria, Spain.
43.143877470922845, -3.902896401340462.
I have lived in Santander for 50 years and I have never been to visit it. I'm lazy!
And don't worry, on ESP8266 it is working without problems for me and I can use these modules for my project.
Post Reply