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,940
Connecting Particle Photon to Cayenne

Things used in this project

Hardware components

Photon
Particle Photon
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Cayenne
myDevices Cayenne

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

Laurence Daxes

2 projects • 35 followers
Systems Engineer Bachellor, I Love technology, and IoT World https://youtube.com/c/DaxesHacks

Comments

Add projectSign up / Login