Can't get ControlEverything.com I2C 4 relay shield Github example to work

Hi guys, I’m trying out the github example to control the relays with my Electron but it doesn’t work.
The firmware build with no errors but when it runs on the Electron the serial monitor shows

turn off all relays banks 1-2 command failed

Also get set address failed.

My .ino code

    #include "NCD4Relay/NCD4Relay.h"
    NCD4Relay relayController;

     char auth[] = "xxx";
     int Relay = 2;
     int led = D7;

     void setup() {
       Serial.begin(9600);
       Particle.keepAlive(PARTICLE_KEEPALIVE);
       relayController.setAddress(0, 0, 0);
       pinMode(led, OUTPUT);
     }

     void loop() {
      digitalWrite(led, HIGH);
      relayController.turnOnAllRelays();
      delay(5000);
      digitalWrite(led, LOW);
      relayController.turnOnAllRelays();
      delay(5000);
     }

First this include statement looks like you are targeting a system 0.5.2 or before and next has this board got address jumpers and if are they set right?

All 3 jumpers are off which I assume is 0,0,0. For the include, should I include the ncd4 library differently?

I set all jumpers to the 1,1,1 position and changed it in my cod and it works now.

1 Like

Trying to use your code
I get this error in first line
Im very new at this

Pat

test1.ino:1:34: NCD4Relay/NCD4Relay.h: No such file or directory

#include "NCD4Relay/NCD4Relay.h"
NCD4Relay relayController;

 char auth[] = "xxx";
 int Relay = 2;
 int led = D7;

 void setup() {
   Serial.begin(9600);
   Particle.keepAlive(PARTICLE_KEEPALIVE);
   relayController.setAddress(1, 1, 1);
   pinMode(led, OUTPUT);
 }

 void loop() {
  digitalWrite(led, HIGH);
  relayController.turnOnAllRelays();
  delay(5000);
  digitalWrite(led, LOW);
  relayController.turnOnAllRelays();
  delay(5000);
 }

Did you import the NCD4Relay library into your project? Also, you might want to try the shorter include like they use in the examples for that library (I don’t know if this makes a difference or not),

#include "NCD4Relay.h"
1 Like

I just copy and pasted it from 1st post on this board
I will play some more tonight

Thx Pat