Go Down

Topic: printing and changing ip info (Read 714 times) previous topic - next topic

phinsil6

Hi, I have the Dum. and Eth Shield.  I am trying to be able to read and print the ip, gw, and subnet info to a telnet session, however I am new to the whole byte, string, char business and am unsure as to how to actually print the values.  for instance i have
Code: [Select]
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 250 };
byte gateway[] = {192,168,1,1};
byte subnet[] = {255,255,255,0};


i've tried something like a telnet.println(ip) but it gives me an "(byte[4]) is ambiguous error.  what kind of syntax should I be using?  also, would I be able to change the ip value from a telnet.read();?

thanks

PaulS

ip is an array of bytes. You print it like any other array - one element at a time, in a loop.

It is the address of the ethernet device. How can it change mid-session?

robtillaart


Check - http://www.arduino.cc/en/Reference/Array

On the tutorial section there is a lot of info about chars and bytes and so - http://arduino.cc/en/Tutorial/HomePage -
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

phinsil6

thanks for the help on the printing of the array.  for the changing the ip, i was thinking that possibly if you changed the ip info in the order of, subnet, gateway, ip then do a soft reset of the device which would restart the ethernet session.  would that work?  it is really imperative that I can change the ip info of the device.  if not possible over the telnet session, could i do it over a serial connection?

PaulS

Quote
it is really imperative that I can change the ip info of the device.

This is the part I have trouble with. Do you routinely change the IP address of your PC? What happens when you try?

Go Up