Hi,
please find the requested photos.
noted am using arduino uno and an ethernet shield as am controlling the reciever through my android phone.
here's the arduino code :
#include <SPI.h>
#include <Ethernet.h>
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 100, 45 };
byte gateway[] = { 192, 168, 100, 1 };
byte subnet[] = { 255, 255, 255, 0 };
EthernetServer server(80);
String readString;
void setup() {
Serial.begin(9600);
mySwitch.enableTransmit(10);
while (!Serial) {
;
}
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (readString.length() < 100) {
readString += c;
//Serial.print(c);
}
if (c == '\n') {
Serial.println(readString);
client.println("HTTP/1.1 200 OK");
delay(1);
client.stop();
if (readString.indexOf("?BedLampON") > 0) {
mySwitch.send(4216115, 24);
}
if (readString.indexOf("?BedLampOFF") > 0) {
mySwitch.send(4216124, 24);
}
if (readString.indexOf("?Wireless1ON") > 0) {
mySwitch.send(5264661, 24);
}
if (readString.indexOf("?Wireless1OFF") > 0) {
mySwitch.send(1070356, 24);
}
if (readString.indexOf("?Wireless2ON") > 0) {
mySwitch.send(5259349, 24);
}
if (readString.indexOf("?Wireless2OFF") > 0) {
mySwitch.send(1065044, 24);
}
if (readString.indexOf("?Wireless3ON") > 0) {
mySwitch.send(5263445, 24);
}
if (readString.indexOf("?Wireless3OFF") > 0) {
mySwitch.send(1069140, 24);
}
readString = "";
}
}
}
}
}