ESP32 modified library


#1

Hi,
I was trying to run the ESP32 example given by bestpika that send millis() to Cayenne and got every time [51] WiFi shield not present

My board is ESP32 exotic Module from China with HW-607 printed on.

I added WiFi.begin(ssid, password); and it works :slight_smile:
Thank you bestpika
Salutations.


#2

Can you post your sketch? I don’t think I’ve seen anyone get an ESP32 connected yet!


#3

Hi,
I just modified CayenneMQTTESP8266 according bestpika github
Renamed library to CayenneMQTTESP32
Here is my code … Tested milis and a LED switch.

// Tested: China exotic board HW-607

#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP32.h>
//#include <WiFi.h> // finally not necessary

char ssid[] = β€œβ€;
char wifiPassword[] = β€œβ€;

// Cayenne authentication info.
char username[] = β€œf”;
char password[] = β€œβ€;
char clientID[] = β€œβ€;

unsigned long lastMillis = 0;

void setup()
{
Serial.begin(115200);
pinMode(17, OUTPUT);
WiFi.begin(ssid, password);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

void loop()
{
Cayenne.loop();
if (millis() - lastMillis > 10000)
{
lastMillis = millis();
Cayenne.virtualWrite(0, lastMillis);
}

}
CAYENNE_IN(1)
{

int currentValue = getValue.asInt();
if (currentValue == 1)
{
digitalWrite(17, HIGH);
}
else {
digitalWrite(17, LOW);
}
}

CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(β€œCAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
}

Salutations