Pages: 1 [2]   Go Down
Author Topic: How to read variables stored on an SDCard?  (Read 1951 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 616
Posts: 49444
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 616
Posts: 49444
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

byte unitid[1] = {0};

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

Serial.println( unitid[0]);


Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 616
Posts: 49444
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: 1 [2]   Go Up
Jump to: