Notifications
Clear all

Need help with finding mac-adress of a Pico W using arduino IDE

64 Posts
5 Users
9 Likes
4,436 Views
Ron
 Ron
(@zander)
Illustrious Member
Joined: 3 years ago
Posts: 5567
 
Posted by: @frits1956

@frogandtoad

My problem is completely solved with your directions and I'm glad you wrote the linux solution also.

The new question, that has now become visible, is why your method gives a correct mac address and @Zander's normally working method does not. Rob and I are curious about that. Is there a library cause or is there something else because it seems to occur only with picoW .....

I failed to notice the print code for the MAC was backwards, have a look at the MAC I gave you but reverse it, should be the same as what you got via the ping/arp method.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 3 years ago
Posts: 5567
 

@frogandtoad Sorry, I assumed that you did it without any sketch loaded since if you did, why bother with the arp when you could just get the mac in the sketch. I suspect your answer will be similar to you already had a piece of server code that displayed the IP available and it was quicker to follow that with the arp than to write the get mac decode mac code.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@frits1956)
Eminent Member
Joined: 3 years ago
Posts: 29
Topic starter  

@zander Yes you did. I have adjusted the void.

@zander @frogandtoad Gentlemen I learned a lot. THANKS!!!

void printMacAddress(byte mac[])
{  for (int i = 0; i <= 5; i++)
     { if (i > 0) 
           Serial.print(":");
        if (mac[i] < 16)
            Serial.print("0");
        Serial.print(mac[i], HEX); 
     } 
     Serial.println();
 }

 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

@frogandtoad Sorry, I assumed that you did it without any sketch loaded since if you did, why bother with the arp when you could just get the mac in the sketch. I suspect your answer will be similar to you already had a piece of server code that displayed the IP available and it was quicker to follow that with the arp than to write the get mac decode mac code.

🙂

You suspect correctly!
Why load a sketch to get the MAC details already available if you know the IP address?

That was the whole point of my initial response.

Cheers


   
Ron reacted
ReplyQuote
Page 5 / 5