Helllooooooo Particle People. I have a Photon that I’m trying to use to open a relay with the Blynk cloud app. The relay board I’m using is the NCD2Relay. I am trying to use pin D0 or D7 to turn on the relay. I’m not sure I have this right but if someone could take a look I would be very happy. BTW, I can turn on the blue LED with D7 pink through Blynk, so I’m pretty sure that part is working. Just not sure about the relay code. Do I have to setup two serial communications? serial and serial1?
Thanks in advance.
here is my code:
// This #include statement was automatically added by the Particle IDE.
#include "NCD2Relay/NCD2Relay.h"
#define BLYNK_PRINT Serial
#include "blynk/blynk.h"
NCD2Relay relayController;
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxx";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
pinMode(D0, OUTPUT);
pinMode(D7, OUTPUT);
relayController.setAddress(0,0,0);
}
void loop()
{
Blynk.run();
if(D0==HIGH || D7==HIGH){
relayController.turnOnRelay(1);
}
else{
relayController.turnOffRelay(1);
};
}