User avatar
By notdodgy
#56471 New to ESP8266

Just came across this https://www.cayenne-mydevices.com/

An easy way to set up and run IoT devices.

Currently aimed at RasPi and Arduino, however in the community one member has shared a project to make a battery powered monitor using an ESP-12f and a DHT11 sensor.
This monitor reports its readings to the Cayenne dashboard.

Just ordered some ESP-12Fs to try it myself.

I have tried their example code on a Wemos D1R2, but unfortunately it continuously resets. (WDT).
Having got the usual blink program to run ok, I suspect I moved too quickly to something more complicated. :?
User avatar
By jorgemontalvao
#59105 Hi notdodgy

Check it out:
http://community.mydevices.com/t/esp8266/820/20

This is a simple code that worked well for me. My suggestion is you may send data to arduino using SoftwareSerial.

1. Go to Arduino IDE Preferences and enter this URL "http://arduino.esp8266.com/stable/package_esp8266com_index.json" into Additional Board Manager.
2. Go to Boards Manager, search "esp8266" by ESP8266Community, and install it (currently is 2.3.0)
3. Select "Generic ESP8266 Module"
4. Upload this sketch (you may need to hold the flash button if you have it). Make sure you have your Cayenne authentication token.

Code: Select all#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"

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "<your_token>";
// Your network name and password.
char ssid[] = "<your_ssid>";
char password[] = "<your_pwd>";

void setup()
{
  // initialize digital pin 2 as an output.
  pinMode(2, OUTPUT);
  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
}

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

// This function will be called every time a Dashboard widget writes a value to Virtual Pin 2.
CAYENNE_IN(V2)
{
  CAYENNE_LOG("Got a value: %s", getValue.asStr());
  int i = getValue.asInt();
 
  if (i == 0)
  {
    digitalWrite(2, LOW);
  }
  else
  {
    digitalWrite(2, HIGH);
  } 
}


Change this code to send data to your Arduino using SoftwareSerial.