Go Down

Topic: How to read variables stored on an SDCard? (Read 2291 times) previous topic - next topic

PaulS

Unless the mac address you were using is that of another device on the same network, it shouldn't stop you from pinging it. Not that I care what mac address you use, but, it should have worked as long as it was unique.

Onenate

that what I would have thought but I think it must have been conflicting with something else but hey it all good now :)


with the unit id issue  does it have anything to do with the %u I have tried to other thing such as %d and still the same result.

  sscanf(buffer, "unitid=%u", &unitid[1]);

or is it more to do with the
byte unitid[1] = {0};
should this be something different not a byte?

PaulS

The type is fine. The size of the array is 1. That means the valid indices are in the range 0 to 0. Notice that 1 is not in that range.

Onenate

I get that now that 1 is not their so I have change it

but still this is still giving me the 232

... inside the Loop
Mac Address Print Out = mac=DE:AD:BE:EF:FE:ED
IP Address Print Out = ip=192.168.3.177
Unitid Address Print Out = unitid=1000
Connecting to network
Mac: DE:AD:BE:EF:FE:ED
IP: 192.168.3.177
Unitid: 232
IP Address Set = 192.168.3.177

 

Code: [Select]


byte unitid[1] = {0};

sscanf(buffer, "unitid=%u", &unitid[0]);

Serial.println( unitid[0]);




PaulS

A value of 1000 will not fit in a byte. You need an int. I hadn't gone back to look at the size of the value you were trying to store in unitid.

Onenate

you are the MAN!!!!!!!!!!!!

change it to int unitid[1] = {0}; and bang!!!

... inside the Loop
Mac Address Print Out = mac=DE:AD:BE:EF:FE:ED
IP Address Print Out = ip=192.168.3.177
Unitid Address Print Out = unitid=1000
Connecting to network
Mac: DE:AD:BE:EF:FE:ED
IP: 192.168.3.177
Unitid: 1000
IP Address Set = 192.168.3.177


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