ESP-NOW Mac Address compile error

chuck808
Posts: 7
Joined: Sun Jan 31, 2021 12:57 pm

ESP-NOW Mac Address compile error

Postby chuck808 » Sun Feb 14, 2021 12:07 pm

Hello,

Trying to run the samples from https://randomnerdtutorials.com/esp-now ... duino-ide/ Getting Started with ESP-NOW (ESP32 with Arduino IDE), but keep running into compile error. The board I am using is the ESP-WROON-32 dev board.

If I run the sketches with

Code: Untitled.cpp Select all

// REPLACE WITH YOUR RECEIVER MAC Address
uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
, everything runs as expected.

However, if I replace the broadcast address with the Mac Address of the receiver

Code: Untitled.cpp Select all

// REPLACE WITH YOUR RECEIVER MAC Address
uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78};
, I get the following error message.

Code: Untitled.txt Select all

Arduino: 1.8.13 (Windows 10), 
Board: "ESP32 Dev Module,
Disabled,
Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS),
240MHz (WiFi/BT),
QIO, 80MHz,
4MB (32Mb),
921600,
None"

sketch_feb14a:16:36: error: expected '}' before ':' token

uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78}; ^

sketch_feb14a:16:36: error: name 'AC' used in a GNU-style designated initializer for an array

sketch_feb14a:16:36: error: expected ',' or ';' before ':' token

sketch_feb14a:16:48: error: expected declaration before '}' token

uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78}; ^

Multiple libraries were found for "WiFi.h"

Used: C:\Users\name\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi

Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

exit status 1

expected '}' before ':' token
I have read some posts that suggest removing one of the instances of "WiFI.h", but that doesn't fix the issue.

Any suggestions?

Thanks

ChrisMCU
Posts: 5
Joined: Sun Feb 14, 2021 11:24 am

Re: ESP-NOW Mac Address compile error

Postby ChrisMCU » Sun Feb 14, 2021 12:52 pm

Code: Untitled.cpp Select all

uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78};
should be:

Code: Untitled.cpp Select all

uint8_t broadcastAddress[] = {0xAC, 0x67, 0xB2, 0x26, 0x5D, 0x78};

lbernstone
Posts: 1138
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP-NOW Mac Address compile error

Postby lbernstone » Sun Feb 14, 2021 3:28 pm

"AC" is a string. 0xAC is a uint8_t.

chuck808
Posts: 7
Joined: Sun Jan 31, 2021 12:57 pm

Re: ESP-NOW Mac Address compile error

Postby chuck808 » Sun Feb 14, 2021 9:25 pm

Hello lbernstone,

:( :o :shock: :? :oops: :mrgreen:

What an idiot I am.

Thanks

Who is online

Users browsing this forum: Amazon [Bot], PerplexityBot and 2 guests