HI,
i've tried to get the webserver example of RC switch to run, but it does not read any command and therefore always calls the httpResponseHome(client);
But why's that?
I'm on mega 2560 with ethernetshield.
i'm including the following:
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <RCSwitch.h>
#include "pitches.h"
char* httpServer() {
doMainSuff();
EthernetClient client = server.available();
if (client) {
char sReturnCommand[32];
int nCommandPos=-1;
sReturnCommand[0] = '\0';
while (client.connected()) {
if (client.available()) {
char c = client.read();
if ((c == '\n') || (c == ' ' && nCommandPos>-1)) {
sReturnCommand[nCommandPos] = '\0';
if (strcmp(sReturnCommand, "\0") == 0) {
Serial.print(sReturnCommand);
Serial.println("httpResponeHome ");
httpResponseHome(client);
} else {
Serial.print("processCommand ");
Serial.println(sReturnCommand);
processCommand(sReturnCommand);
httpResponseRedirect(client);
}
break;
}
if (nCommandPos>-1) {
sReturnCommand[nCommandPos++] = c;
}
if (c == '?' && nCommandPos == -1) {
nCommandPos = 0;
}
}
if (nCommandPos > 30) {
Serial.print("414");
httpResponse414(client);
sReturnCommand[0] = '\0';
break;
}
}
if (nCommandPos!=-1) {
sReturnCommand[nCommandPos] = '\0';
}
// give the web browser time to receive the data
Alarm.delay(1);
client.stop();
return sReturnCommand;
}
return '\0';
}
once more thanks for advice