Reading off SD card to set up Ethernet2 mac and IP address

I have a csv file on the SD card for setting up parameters rather than hard coding. The problem I am having is with the Ethernet2 MAC and IP address.

However, I just can not get the correct data type in from the SD card and pass it to the IPAddress IP and MAC. for the Ethernet2 set up. The data is being parsed ok, I suspect its just the type.

Originally I was transferring the SD data into ch's but this failed, then tried to use bytes but this also failed.

Thanks for any help in advance.

Please post the sketch that is causing the problem ?

Sorry a bit messy, the settings contain relevant set up info, the ino file parses the data into global parameters (will tidy up later), but the open port function is the problem. The ino file so not really reflecting what I had tried, however instead of hard coding the MAC and IP address, I want to load it off the SD card and assign the parameters from that. In my example my plan did not work so I was trying to explore what could be done hard coding and mimic it. I ended up trying various things last night.

its this bit,byte mac =
{
0xA8,0x61,0x0A,0xAE,0x2D,0x3D
};

To provide portability in the code, i want the SD card to have the parameters.

Any ideas?

Trend_to_modbus_R40.ino (3.15 KB)

changed all cg to uint8_t and using: (still need to play around with other inputs.

EthernetClient client;
Ethernet.begin(cArduino_MAC, cArduino_IP);

I can ping Uno, however once I ping I use arp -a to check mac address but it comes out different?
So getting somewhere, but not quite understanding.

Also do you know why ‘do’ loops do not work in switch statement as all these ‘ifs’ drive me mad.

Colin

ignore that ping and arp -a, snap shot, noticed I was still connected to wirelsss and I was picking up my test rig.

That is why the mac address was wrong,

But still no joy on setting up the etherent2 paramters

Colin

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

Pictures of code or serial output are useless and will get little or no attention