outputs are overwritten when network connection fails ??

Dear reader…

We have a problem we cant figure out ??? please help us !!!

we created a sketch to switch 6 relays on and off. The uno is connected with a wiz5100 network shield and gets its input from a remote php file that sends a output string like 110101

BUT when the network connection fails (either cable disconnect or packet-error) the 6 string outputs are overwritten with 111111.
While there is no command or function for changing the output high or low.

In the LOOP, ‘read_current’ and ‘read_last’ was created to filter network failures.

i attached the sketch below

thnx daniel

failed_script.ino (12.6 KB)

if (client.connect(server, server_port)) {

	} else {	// if you didn't get a connection to the server:
		for (int x=1; x <= 6; x++) {
			rsx_port[x] = HIGH;

The issue you mentioned is very obviously in the else statement above. You are setting all the values high when the connection fails. I have to be honest, the code is in a great mess. You have a ton of Strings, plus you are using an uno, you are going to have memory issues very quickly. In addition, you are converting chars to String, then back to char(arrays) again, which is completely redundant.

Hi Byork

is it not possible to do this with an uno ?

and if i change the HIGH to LOW nothing changes ???
either HIGH or LOW all leds/relays go on when disconnected from ethernet.

greetz daniel