Thanks Zoomkat
here is the last one we tried when we trying to turn on and off all of the pins....
#include <SPI.h>
#include <Ethernet.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0x6C,0x62,0x6D,0xEE,0x78,0x9D };
////
IPAddress server(184,172,223,94);
String response = "";
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
int flag = 0;
int led = 9;
void setup() {
Serial.begin(9600);
pinMode(0,OUTPUT);
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(14,OUTPUT);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 8080)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /seatmateapi/resources/constructionSites/isSiteActiveAndOccupied?macAddress=6C-62-6D-EE-78-9D HTTP/1.0");
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c;
c = client.read();
response += c;
}
if (!client.connected()) {
Serial.print(response);
Serial.println("\ndisconnecting.");
client.stop();
client.connect(server, 8080);
client.println("GET /seatmateapi/resources/constructionSites/isSiteActiveAndOccupied?macAddress=6C-62-6D-EE-78-9D HTTP/1.0");
client.println();
delay(1000);
if(response.indexOf("INACTIVE") > 0) {
//if(flag == 1) {
Serial.println("LIGHTS OFF");
digitalWrite(0, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(2, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(3, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(4, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(6, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(7, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(8, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(9, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(10, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(11, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level)
flag = 0;
//}
}
else {
//if(flag == 0) {
Serial.println("LIGHTS ON.");
digitalWrite(0, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(2, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(3, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(4, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(6, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(7, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(8, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(9, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(10, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(11, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level)
flag = 1;
//}
}
response = "";
}
}