#include #include #include #define CAYENNE_DEBUG // Uncomment to show debug messages #define CAYENNE_PRINT Serial // Comment this out to disable prints and save space #include "CayenneDefines.h" #include "BlynkSimpleEsp8266.h" #include "CayenneWiFiClient.h" #include #include const int relayPin = 12; const int tmpPin1 = 4; const int tmpPin2 = 5; //const int sensorPin= A0; //float light_level; // Cayenne authentication token. This should be obtained from the Cayenne Dashboard. char token[] = "myToken"; // Your network name and password. char ssid[] = "MySSID"; char password[] = "Mypassword"; OneWire oneWire1 (tmpPin1); OneWire oneWire2 (tmpPin2); DallasTemperature sensors1(&oneWire1); DallasTemperature sensors2(&oneWire2); void setup() { Serial.begin(115200); Cayenne.begin(token, ssid, password); // initialize digital pin 10 as an output. pinMode(4, INPUT); pinMode(5, INPUT); pinMode(12, OUTPUT); //pinMode(A0, INPUT); } void loop(){ //light_level = analogRead(A0); //Serial.println(light_level); //delay(1000); Cayenne.run(); } CAYENNE_OUT(V1) { //Send the command to get temperatures. sensors1.requestTemperatures(); // This command writes the temperature in Celsius to the Virtual Pin. // To send the temperature in Fahrenheit use the corresponding code below. Cayenne.virtualWrite(V1, sensors1.getTempCByIndex(0)); } //CAYENNE_OUT(V3) //{ // Cayenne.virtualWrite(V3, light_level); //} CAYENNE_OUT(V2) { //Send the command to get temperatures. sensors2.requestTemperatures(); // This command writes the temperature in Celsius to the Virtual Pin. // To send the temperature in Fahrenheit use the corresponding code below. Cayenne.virtualWrite(V2, sensors2.getTempCByIndex(0)); }