Go Down

Topic: How to read variables stored on an SDCard? (Read 2 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