Hi all,
I am trying to get my Arduino’s mac address so that i could give it a static IP.
I used a very simple code taken from the arduino website (can be found at the end of the post)
I seem to be getting a mac address like this:
X1:Y2:Z:Z4:U5:O3
these arn’t the real letters, but the point is that the 3rd byte keeps giving my just a one letter and nothing else, and this is not a valid mac address.
i tried to play around and only display that byte and other such games, but they all were not successful.
Anyone have any idea on how I can manage to get the full mac address?
Thanks!
Code used (of course i change the ssid and added pass etc):
#include <SPI.h>
#include <WiFi.h>
char ssid = “yourNetwork”; // the name of your network
int status = WL_IDLE_STATUS; // the Wifi radio’s status
byte mac[6]; // the MAC address of your Wifi shield
void setup()
{
Serial.begin(9600);
status = WiFi.begin(ssid);
if ( status != WL_CONNECTED) {
Serial.println(“Couldn’t get a wifi connection”);
while(true);
}
// if you are connected, print your MAC address:
else {
WiFi.macAddress(mac);
Serial.print(“MAC: “);
Serial.print(mac[5],HEX);
Serial.print(”:”);
Serial.print(mac[4],HEX);
Serial.print(":");
Serial.print(mac[3],HEX);
Serial.print(":");
Serial.print(mac[2],HEX);
Serial.print(":");
Serial.print(mac[1],HEX);
Serial.print(":");
Serial.println(mac[0],HEX);
}
}
void loop () {}