Pages: [1]   Go Down
Author Topic: MAC address help!  (Read 332 times)
0 Members and 1 Guest are viewing this topic.
Brussels
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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!!
Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 254
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to type it like it is in the example:
Code:
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.
Logged

Brussels
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, thank you!! smiley
Logged

Pages: [1]   Go Up
Jump to: