vermar
1
Hi,
I am trying to print a mac address in byte in the serial monitor and i get this error :
no matching function for call to 'print(byte [6])'
I have tried with serial.write :same error
Help a beginner please!
my code:
byte addr[6] = {0,0,0,0,0,0}; //to keep MAC address of the remote device
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print(addr);
delay(500);
}
kolaha
2
you must each element to print
for (byte i=0; i<6; i++){
Serial.print(addr[i]);
if(i<5)Serial.print(':');
else Serial.println();
}
I think your array goes from 0-5 not 1-6?
If the MAC address is in the 6 bytes of the addr array then you can print them using a for loop
for (int x = 0; x < 6; x++)
{
Serial.println(addr[x]);
}
If the MAC address were in a C style string then you could print it with a single print command
1 Like
system
Closed
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.