Go Down

Topic: MAC address help! (Read 420 times) previous topic - next topic

Hey guys!

please help! i have an ethernet shield connected to my Arduino 1:
the sticker for the MAC address reads: "90-A2-DA-0D-A8-AF"

in this code, what do i put for the mac address? i get
"DhcpAddressPrinter.ino:22:24: error: invalid suffix "D" on integer constant" error and other
"hcpAddressPrinter:22: error: 'DA' was not declared in this scope" errors if i put "90,A2,DA,0D,A8,AF" for the MAC address???

Code: [Select]
#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
...



thanks!!

tobyb121

You need to type it like it is in the example:
Code: [Select]
byte mac[] = {  0x90, 0xA2, 0xDA, 0x0D, 0xAF, 0xAF };
The MAC address is a set of 6 bytes (8 bit numbers between 0 and 255). The notation used is called hexadecimal/base 16 (http://en.wikipedia.org/wiki/Hexadecimal) It's commonly used because each hexadecimal digit is represented by 4 bits, so a 8 bit byte is two hex digits, e.g. A2 which is 10*16+2*1=162.


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy