Ivan Cordoba
Published © Apache-2.0

My first IOT with Cayenne, Arduino and CMD

A basic project in order to connect Arduino and Cayenne by sending the numbers from 1 to 10 without needing an Ethernet shield.

BeginnerProtip1 hour1,427
My first IOT with Cayenne, Arduino and CMD

Things used in this project

Story

Read more

Code

Arduino Code

Arduino
to send the 1 to 10 numbers
#include <CayenneSerial.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "xxxxxxxxx";
#define CAYENNE_PRINT Serial
#define VIRTUAL_PIN V0
float t = 0;
void setup()
{
  //Baud rate can be specified by calling Cayenne.begin(token, 9600);
  Cayenne.begin(token);
  Serial.begin(9600);
}

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

CAYENNE_OUT(V0)
{
  t=t+1;
  if (t==10) {t=0;}
  Cayenne.virtualWrite(V0, t); //virtual pin
  delay (1000);
}

Credits

Ivan Cordoba

Ivan Cordoba

1 project • 2 followers

Comments