Where can I save memory on this code?

HI,

this code is for accessing 4 relays over the internet,
I like to be for 8. when I add 4 more relay to it the board does not respond,
it works up to 5 relay. but after adding the 6th or more it does not.

where could I save memory on this code, Could anyone help please? can I leave some on the SD card? if so, how?

//*****************************************************
#define WEBDUINO_AUTH_REALM "Authentication Required"

#include "SPI.h"
#include "Ethernet.h"
#include "WebServer.h"

static uint8_t mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static uint8_t ip[] = { 
  192, 168, 1, 69 };
int Relay1active = 0; 
int Relay2active = 0;  
int Relay3active = 0;   
int Relay4active = 0;   

// Set the power up state of each relay  
//OFF = 1  ON = 0
int Relay1state = 0; 
int Relay2state = 0;  
int Relay3state = 0;   
int Relay4state = 1;   

//Button Labels
String R1text = "Server Power";
String R2text = "Relay2";
String R3text = "PC Power";
String R4text = "Garage Door";

Don't waste space using ints when bytes will do.
Use C style strings instead of Strings

strcmp(name, "Relay1")

Get constants like this into flash memory, using strcmp_P etc.

server.print(F("<p><button name='Relay1' style='background-color:#088A08; color:#FFFFFF;' value='0'>"));
server.print(R1text);
server.print(F(" - is On</button></p>"));

UK Helibob, thank you, what would be a good C style string to use? can you show me an example for the int please?

and AWOL, how strcmp would allocate all the pins? what would be the command for all of them? thanks

AWOL, how strcmp would allocate all the pins?

I'm sorry, I don't understand the question.

davejava:
UK Helibob, thank you, what would be a good C style string to use? can you show me an example for the int please?

and AWOL, how strcmp would allocate all the pins? what would be the command for all of them? thanks

You don't know int from byte?

C strings are char arrays where the end of text is marked by a char == 0. You need to look it up and study and work with it. There is nothing here that anyone can do to just give that to you. It's not a trivia answer.

I would suggest to treat the relays as examples of the same thing with different data that use the same code as opposed to the copy and change code there now but it's pretty clear to me that you don't understand what you have well enough to make any such change. strcmp() compares strings, for one.