Okay, I am back... I had family in town and had to put this on the back burner. So I received my RS232 shield and it's working, but as I put more code in I am starting to run out of space. So I would like to know if there is a more efficient way to write the code or do I need to buy an Arduino with more memory?
const int button1 = 7;
const int button2 = 8;
const int button3 = 9;
const int button4 = 10;
int lastState1, lastState2, lastState3, lastState4;
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// put your setup code here, to run once:
// wire your buttons up with one side connected to ground
// and the other side connected to the input pin
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(button3, INPUT_PULLUP);
pinMode(button4, INPUT_PULLUP);
//LCD setup
lcd.begin(16, 2);
lcd.print("System Ready");
// initialize serial communication:
Serial.begin(115200);
Serial.println( "Ready" );
}
void loop() {
// put your main code here, to run repeatedly:
int state = digitalRead(button1);
if (state != lastState1 ) {
if ( state == LOW ) {
// Send to LCD
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Setting Zero");
// Send a serial string
Serial.println("xConfiguration Network 1 IPv4 Assignment:Static");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Address: 0.0.0.0");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 SubnetMask: 255.255.255.255");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Gateway: 0.0.0.256");
delay (1000);
Serial.println ("xConfiguration H323 Gatekeeper Address: 000.000.000.000");
delay (1000);
Serial.println ("xConfiguration H323 CallSetup Mode: H323");
delay (1000);
Serial.println ("xConfiguration H323 H323Alias E164: 0000000000");
delay (1000);
Serial.println ("xConfiguration NetworkServices CDP Mode: Off");
delay (1000);
Serial.println ("xConfiguration Network 1 VLAN Voice Mode: Off");
delay (1000);
Serial.println ("xConfiguration NetworkServices H323 Mode: On");
delay (1000);
Serial.println ("xConfiguration NetworkServices SIP Mode: Off");
delay (1000);
Serial.println ("xConfiguration SystemUnit Name: nobody");
delay (1000);
Serial.println ("xCommand SystemUnit Boot [Action: Restart]");
delay (1000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Restarting");
lcd.setCursor(0, 1);
lcd.print(" system");
delay (20000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Network");
lcd.setCursor(0, 1);
lcd.print(" Zero");
}
lastState1 = state;
delay(20);
}
state = digitalRead(button2);
if (state != lastState2 ) {
if ( state == LOW ) {
// Send to LCD
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Setting N1");
// Send a serial string
Serial.println("xConfiguration Network 1 IPv4 Assignment:Static");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Address: 0.0.0.0");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 SubnetMask: 255.255.255.255");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Gateway: 0.0.0.256");
delay (1000);
Serial.println ("xConfiguration H323 Gatekeeper Address: 000.000.000.000");
delay (1000);
Serial.println ("xConfiguration H323 CallSetup Mode: H323");
delay (1000);
Serial.println ("xConfiguration H323 H323Alias E164: 0000000000");
delay (1000);
Serial.println ("xConfiguration NetworkServices CDP Mode: Off");
delay (1000);
Serial.println ("xConfiguration Network 1 VLAN Voice Mode: Off");
delay (1000);
Serial.println ("xConfiguration NetworkServices H323 Mode: On");
delay (1000);
Serial.println ("xConfiguration NetworkServices SIP Mode: Off");
delay (1000);
Serial.println ("xConfiguration SystemUnit Name: N1");
delay (1000);
Serial.println ("xCommand SystemUnit Boot [Action: Restart]");
delay (1000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Restarting");
lcd.setCursor(0, 1);
lcd.print(" system");
delay (20000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Network");
lcd.setCursor(0, 1);
lcd.print(" ONE");
}
lastState2 = state;
delay(20);
}
state = digitalRead(button3);
if (state != lastState3 ) {
if ( state == LOW ) {
// Send to LCD
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Setting N2");
// Send a serial string
Serial.println("xConfiguration Network 1 IPv4 Assignment:Static");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Address: 0.0.0.0");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 SubnetMask: 255.255.255.255");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Gateway: 0.0.0.256");
delay (1000);
Serial.println ("xConfiguration H323 Gatekeeper Address: 000.000.000.000");
delay (1000);
Serial.println ("xConfiguration H323 CallSetup Mode: H323");
delay (1000);
Serial.println ("xConfiguration H323 H323Alias E164: 0000000000");
delay (1000);
Serial.println ("xConfiguration NetworkServices CDP Mode: Off");
delay (1000);
Serial.println ("xConfiguration Network 1 VLAN Voice Mode: Off");
delay (1000);
Serial.println ("xConfiguration NetworkServices H323 Mode: On");
delay (1000);
Serial.println ("xConfiguration NetworkServices SIP Mode: Off");
delay (1000);
Serial.println ("xConfiguration SystemUnit Name: N1");
delay (1000);
Serial.println ("xCommand SystemUnit Boot [Action: Restart]");
delay (1000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Restarting");
lcd.setCursor(0, 1);
lcd.print(" system");
delay (20000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Network");
lcd.setCursor(0, 1);
lcd.print(" TWO");
}
lastState3 = state;
delay(20);
}
state = digitalRead(button4);
if (state != lastState4 ) {
if ( state == LOW ) {
// Send to LCD
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Setting N6");
// Send a serial string
Serial.println("xConfiguration Network 1 IPv4 Assignment:Static");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Address: 0.0.0.0");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 SubnetMask: 255.255.255.255");
delay (1000);
Serial.println("xConfiguration Network 1 IPv4 Gateway: 0.0.0.256");
delay (1000);
Serial.println ("xConfiguration H323 Gatekeeper Address: 000.000.000.000");
delay (1000);
Serial.println ("xConfiguration H323 CallSetup Mode: H323");
delay (1000);
Serial.println ("xConfiguration H323 H323Alias E164: 0000000000");
delay (1000);
Serial.println ("xConfiguration NetworkServices CDP Mode: Off");
delay (1000);
Serial.println ("xConfiguration Network 1 VLAN Voice Mode: Off");
delay (1000);
Serial.println ("xConfiguration NetworkServices H323 Mode: On");
delay (1000);
Serial.println ("xConfiguration NetworkServices SIP Mode: Off");
delay (1000);
Serial.println ("xConfiguration SystemUnit Name: N1");
delay (1000);
Serial.println ("xCommand SystemUnit Boot [Action: Restart]");
delay (1000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Restarting");
lcd.setCursor(0, 1);
lcd.print(" system");
delay (20000);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" Network");
lcd.setCursor(0, 1);
lcd.print(" Three");
}
lastState4 = state;
delay(20);
}
}