I am trying to add a momentary delay into this code and is keep erroring out on me. I want this html button to switch a relay on(1) for less than a second and go back to (0) waiting for the next time the button is pressed. I'm a absolute beginner at this and the code i have came out of a book. i just tried to modify it for my use and now i'm stuck.
I need it on i = 6 as 6 will be going to my relay.
// table with buttons from 2 through 9
// 2 AND 3 are inputs, the other buttons are outputs
client.println(F("<table border='1'>"));
// show the input pins
for (int i = 2; i < 4; i++) { // pins 2,and 3 are inputs
pinMode(i, INPUT);
digitalWrite(i,LOW); // turn on pull-ups
client.print(F("<tr><td>Door Open"));
client.print(i);
//client.print(F(" </td><td>"));
//client.print(F("  </td><td>"));
//client.print(F(" </td><td>"));
client.print(F("  </td><td>"));
if(digitalRead(i) == HIGH)
//client.print("HIGH");
printP(led_on);
else
//client.print("LOW");
printP(led_off);
client.println("</td></tr>");
}
// show output pin 6
// note pins 10-13 are used by the ethernet shield
for (int i = 6; i < 7; i++) {
client.print(F("<tr><td>digital output "));
client.print(i);
client.print(F(" </td><td>"));
htmlButton( "Open", "pinD", i, "1");
delay (250);
else
client.print(F(" </td><td>"));
client.print(F(" </td><td>"));
htmlButton("Close", "pinD", i, "0");
client.print(F(" </td><td>"));
if(digitalRead(i) == LOW)
//client.print("Low");
printP(led_off);
else
//client.print("high");
printP(led_on);
client.println(F("</td></tr>"));
}
client.println(F("</table>"));
}
I hope this is enough code, I can add more if needed.
Thanks