my code is:
//WiFi connection-IoT SERVER-----------------------------------------------------------------------------------
#include <SPI.h>
#include <WiFi.h>
#include <Wire.h>
#include “Adafruit_HDC1000.h”
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
#include <UbidotsArduino.h>
#define ID “578ba8e97625423621131d11” // PIR SENSOR
#define ID2 “578ba8ad76254231d9da68d1” // Temperature
#define ID3 “578ba8b676254232a9951854” // Humidiity
#define ID4 “57892043762542463541ad86” // Humidex
#define ID5 “5789204c76254246310c00ef” // light
#define ID6 “-” // Sound
#define ID7 “-” // Force
#define ID8 “-” // Medication
#define ID9 “-” // Product Base
#define ID10 “-” // Relay
#define TOKEN “bROkgjIFJPTYv0g8rFy0dLg5dmY4CM” // Put here your Ubidots TOKEN
char ssid[] = “ZOIS-wireless-LAN”; // your network SSID (name)
char pass[] = “korleone”; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
Ubidots client(TOKEN);
Adafruit_HDC1000 hdc = Adafruit_HDC1000();//Temperature
float humidex;
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);//Light Sensor
//PIR sensor-----------------------------------------------------------------------------------------------------
long unsigned int lowIn; //the time when the sensor outputs a low impulse
long unsigned int pause = 5000; //the amount of milliseconds the sensor has to be low before we assume all motion has stopped
boolean lockLow = true;
boolean takeLowTime;
int pirPin = 45; //the digital pin connected to the PIR sensor’s output
int pirValue=0;
int ledPin = 13;
//Product Base-------------------------------------------------------------------------------------------------
int laserPin =35; //pin for Laser
int lightPin = 11; //pin for Photo resistor
int productStatus;
void setup(){
Serial.begin(9600);
//WiFi connection to IoT server-----------------------------------------
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
Serial.println("Please upgrade the firmware");
}
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
Serial.println("Connected to wifi");
printWifiStatus();
}
//PIR SENSOR SETUP--------------------------------------------------
pinMode(pirPin, INPUT);
digitalWrite(pirPin, LOW);
pinMode(laserPin, OUTPUT);//Product Base
//Temperature & Humidity sensor------------------------------------
Serial.println(“HDC100x test”);
if (!hdc.begin()) {
Serial.println(“Couldn’t find sensor!”);
while (1);
}
//Light Sensor Setup--------------------------------------------------
tsl.begin();
}
void loop(){
//Temperature - Humidity - Humidex data to IoT Server
Serial.println(hdc.readTemperature());
Serial.println(hdc.readHumidity());
humidex = calculate_humidex (hdc.readTemperature(), hdc.readHumidity()); //humidex is calculated
Serial.println(humidex);
//Light Sensor----------------------------------------------------------
sensors_event_t event;
tsl.getEvent(&event);
Serial.print(event.light);
client.add(ID, digitalRead(pirPin));//PIR DATA to IoT Server
client.add(ID2, hdc.readTemperature()); //Temperature
client.add(ID3, hdc.readHumidity()); //Humidity
client.add(ID4, humidex); //Humidex
client.add(ID5, event.light); //Light
client.sendAll();
}
//function to calculete Humidex-----------------------
float calculate_humidex(float temperature,float humidity) {
float e;
e = (6.112 * pow(10,(7.5 * temperature/(237.7 + temperature))) * humidity/100); //vapor pressure
float humidex = temperature + 0.55555555 * (e - 10.0); //humidex
return humidex;
}
//function to print WiFi Status info
void printWifiStatus() {
// print the SSID of the network you’re attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield’s IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print(“signal strength (RSSI):”);
Serial.print(rssi);
Serial.println(" dBm");
}
void quit(){
while(true);
}