Could some of you help me? The triggers don’t work for me.It just doesn’t do anything even though the button is pushed.
the code:
#include <CayenneMQTTESP8266.h>
#include <DHT.h>
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
char ssid[] = "im";
char password[] = "not clever";
char username[]="k";
char mqtt_password[] = "boi";
char client_id[] = "thanks";
int buttonstate;
void setup() {
// put your setup code here, to run once:
Cayenne.begin(username,mqtt_password,client_id,ssid,password);
pinMode(D6, OUTPUT);
digitalWrite(D6, LOW);
pinMode(D5, OUTPUT);
digitalWrite(D5, LOW);
pinMode(D7, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int buttonstate = digitalRead(D7);
Cayenne.loop();
if(buttonstate == HIGH) {
Cayenne.virtualWrite(2, HIGH);
}else {
Cayenne.virtualWrite(2, LOW);
}
}
CAYENNE_IN(0)
{
digitalWrite(D6, getValue.asInt());
}
CAYENNE_IN(1)
{
digitalWrite(D5, getValue.asInt());
}