Apparent error in example code for Wifi MAC address

I have just started using an ESP8266 and used the example from here:

Having connected my NodeMCUESP8266 to my hub i can see the MAC address there.
The example code seems to print the MAC address back to front.
running from 5 thru 0 of the array.
If i change the code to 0 thru 5 it matches the mac address registered on my hub and the call for chip_id
matches the last three characters. (right most)

regards

Wayne

Which library are you using?

Note that reference page is for use with the Arduino WiFi library, written for the Arduino WiFi shield. Since you're using an ESP8266 you're definitely not using that library. However, usually the libraries for the ESP8266 are intended to be compatible with the Arduino WiFi library's API, and may even link to the WiFi library reference pages as their documentation. So this would more likely be considered a bug with the library you're using unless the macAddress() function of that library was intentionally written to work differently, in which case that behavior should be clearly documented.

Hi pert,

thanks for your reply ,

I installed ESP8226 as per :

The library version reported as 2.3.0

looking at github for esp8266 they say it is based on arduino wifi shield?

I tried in vain to find the ESP8266Wifi.h file on my system not sure how the board manager installs the libraries.

Any help in finding it would be useful thanks.
Then i can check the code against the arduino original

regards

Wayne

You can find it by doing this:

  • Tools > Board > select any ESP8266 board
  • File > Examples > ESP8266WiFi > HTTPSRequest
  • Sketch > Show Sketch Folder - this will open ...libraries/ESP8266WiFi/examples/HTTPSRequest

The library source files are at ...libraries/ESP8266WiFi/src

The documentation for the function is here:
https://github.com/esp8266/Arduino/blob/master/doc/esp8266wifi/station-class.md#macaddress

Hi Pert,

Thank you for your patience and help.
I have now found said code but it looks like you have already done the hard work for me.

regards

Wayne