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
  1. // REPLACE WITH YOUR RECEIVER MAC Address
  2. 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
  1. // REPLACE WITH YOUR RECEIVER MAC Address
  2. uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78};
, I get the following error message.

  1. Arduino: 1.8.13 (Windows 10),
  2. Board: "ESP32 Dev Module,
  3. Disabled,
  4. Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS),
  5. 240MHz (WiFi/BT),
  6. QIO, 80MHz,
  7. 4MB (32Mb),
  8. 921600,
  9. None"
  10.  
  11. sketch_feb14a:16:36: error: expected '}' before ':' token
  12.  
  13.  uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78};                               ^
  14.  
  15. sketch_feb14a:16:36: error: name 'AC' used in a GNU-style designated initializer for an array
  16.  
  17. sketch_feb14a:16:36: error: expected ',' or ';' before ':' token
  18.  
  19. sketch_feb14a:16:48: error: expected declaration before '}' token
  20.  
  21.  uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78};                                            ^
  22.  
  23. Multiple libraries were found for "WiFi.h"
  24.  
  25.  Used: C:\Users\name\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
  26.  
  27.  Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
  28.  
  29. exit status 1
  30.  
  31. 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

  1. uint8_t broadcastAddress[] = {AC:67:B2:26:5D:78};
should be:
  1. uint8_t broadcastAddress[] = {0xAC, 0x67, 0xB2, 0x26, 0x5D, 0x78};

lbernstone
Posts: 826
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: No registered users and 70 guests