I am pretty new to NodeMCU (ESP8266) and Arduino IDE in general. I followed various documentation / blogs to set up 2 Channel Relay with NodeMCU chip.
Below is sketch code for it.
#include<CayenneMQTTESP8266.h>
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#define LEFT_GARAGE 4
#define RIGHT_GARAGE 5
char ssid[] = "XXXXXXXXXXXXXXXXXXXXXXXX";
char password[] = "XXXXXXXXXXXXXXXXXXXXXX";
char username[] = ""XXXXXXXXXXXXXXXXXXXXXX";";
char mqtt_password[] = ""XXXXXXXXXXXXXXXXXXXXXX";";
char client_id[] = ""XXXXXXXXXXXXXXXXXXXXXX";";
void setup() {
Cayenne.begin(username, mqtt_password, client_id, ssid, password);
pinMode(LEFT_GARAGE, OUTPUT);
digitalWrite(LEFT_GARAGE, HIGH);
pinMode(RIGHT_GARAGE, OUTPUT);
digitalWrite(RIGHT_GARAGE, HIGH);
}
void loop() {
Cayenne.loop();
}
// Left Garage Door
CAYENNE_IN(0){
int currentValue = getValue.asInt();
digitalWrite(LEFT_GARAGE,!currentValue);
}
//Right Garage Door
CAYENNE_IN(1){
digitalWrite(RIGHT_GARAGE,!getValue.asInt());
}
On relay board I tried to connect wire in 2 different configuration.
1st Config:
vcc -> 3.3v from NodeMCU
in1 -> D1/GPIO 04 from NodeMCU
in2 -> D2/GPIO 5 from NodeMCU
GND -> GRD from NodeMCU
2nd Config:
vcc -> 5v USB from NodeMCU
in1 -> D1/GPIO 04 from NodeMCU
in2 -> D2/GPIO 5 from NodeMCU
GND -> GRD from NodeMCU
In 1st config, On relay board respective LED's are turning on when Cayenne buttons are pressed but when I check for continuity on multi meter I don't get anything.
In 2nd config, no LED and no continuity.
am I missing something here? Any feedback/comments are highly appreciated.