Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Laurence Daxes
Published © MIT

Connecting Particle Photon to Cayenne

Experiment using Photon and keeping all boards connnected to Cayenne, which are also compatible with Blynk.

IntermediateProtip1 hour1,958
Connecting Particle Photon to Cayenne

Things used in this project

Story

Read more

Code

01-cayenne.ino

Arduino
#define CAYENNE_PRINT Serial
#include "cayenne-particle/cayenne-particle.h"

char auth[] = "nezswd70wi";
int ledPin = D6;
int virtualPin = 1;

void setup()
{
    pinMode(ledPin, OUTPUT);
    Serial.begin(9600);
    delay(5000); // Allow board to settle
    Blynk.begin(auth);
}



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


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

Credits

Laurence Daxes
19 projects • 36 followers
Systems Engineer Bachellor, I Love technology, and IoT World https://youtube.com/c/DaxesHacks

Comments