Home devices control system with cayanne

details

Home devices control system with cayanne

2017-02-03_cayanne

Home devices control system using Cayenne This project is about controlling home devices through cayenne and Arduino. It is very easy to connect your devices with internet through Cayenne IOT solutions.

Hardware components:

-. Arduino UNO & Genuino UNO

-. Arduino Ethernet Shield

-. Arduino Leonardo

-. Relay (generic)

Software apps and online services:

-. Cayenne

Story

 

Code:

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

// If you're not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples.
#include <CayenneEthernet.h>

#define VIRTUAL_PIN1 1
#define VIRTUAL_PIN2 2
#define RELAY_DIGITAL_PIN1 4
#define RELAY_DIGITAL_PIN2 5
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "kcqd0oywxa";

void setup()
{
  // set digital pin to output
  pinMode(RELAY_DIGITAL_PIN1, OUTPUT);
  pinMode(RELAY_DIGITAL_PIN2, OUTPUT);

  Serial.begin(9600);
  Cayenne.begin(token);
}

CAYENNE_IN(VIRTUAL_PIN1)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 1) {
    digitalWrite(RELAY_DIGITAL_PIN1, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN1, LOW);
  }
}
CAYENNE_IN(VIRTUAL_PIN2)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 1) {
    digitalWrite(RELAY_DIGITAL_PIN2, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN2, LOW);
  }
}

void loop()
{
  Cayenne.run();
}

 

If you want to know more in detail, refer to

Source : https://www.hackster.io/bilal-malik/home-devices-control-system-with-cayanne-c29ca9рубли онлайн займ

 

Home devices control system with cayanne

2017-02-03_cayanne

Home devices control system using Cayenne This project is about controlling home devices through cayenne and Arduino. It is very easy to connect your devices with internet through Cayenne IOT solutions.

Hardware components:

-. Arduino UNO & Genuino UNO

-. Arduino Ethernet Shield

-. Arduino Leonardo

-. Relay (generic)

Software apps and online services:

-. Cayenne

Story

 

Code:

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

// If you're not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples.
#include <CayenneEthernet.h>

#define VIRTUAL_PIN1 1
#define VIRTUAL_PIN2 2
#define RELAY_DIGITAL_PIN1 4
#define RELAY_DIGITAL_PIN2 5
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "kcqd0oywxa";

void setup()
{
  // set digital pin to output
  pinMode(RELAY_DIGITAL_PIN1, OUTPUT);
  pinMode(RELAY_DIGITAL_PIN2, OUTPUT);

  Serial.begin(9600);
  Cayenne.begin(token);
}

CAYENNE_IN(VIRTUAL_PIN1)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 1) {
    digitalWrite(RELAY_DIGITAL_PIN1, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN1, LOW);
  }
}
CAYENNE_IN(VIRTUAL_PIN2)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 1) {
    digitalWrite(RELAY_DIGITAL_PIN2, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN2, LOW);
  }
}

void loop()
{
  Cayenne.run();
}

 

If you want to know more in detail, refer to

Source : https://www.hackster.io/bilal-malik/home-devices-control-system-with-cayanne-c29ca9рубли онлайн займ

 

COMMENTS

Please Login to comment
  Subscribe  
Notify of