- Sun Dec 04, 2016 7:17 pm
#59105
Hi notdodgy
Check it out:
http://community.mydevices.com/t/esp8266/820/20This 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.