I have several qwiic single relays I assigned addresses to, 0x18, 0x19, 0x20 but I can’t figure out how to code them. I was trying this:
#include “SparkFun_Qwiic_Relay.h”
#define RELAY_ADDR 0x18
#define RELAY_ADDR19 0x19
Qwiic_Relay relay(RELAY_ADDR);
Qwiic_Relay relay19(RELAY_ADDR19);
and in setup I define it as:
if(!relay.begin())
Serial.println(“Check connections to Qwiic Relay.”);
else
Serial.println(“Ready to flip some switches.”);
float version = relay.singleRelayVersion();
Serial.print("Firmware Version: ");
Serial.println(version);
if(!relay19.begin())
Serial.println(“Check connections to Qwiic Relay.”);
else
Serial.println(“Ready to flip some switches.”);
float version19 = relay19.singleRelayVersion();
Serial.print("19 Firmware Version: ");
Serial.println(version19);
but when the code runs and I try and query the relay status
int state19 = relay19.getState();
Serial.print("19 ");Serial.println(state19);
it seems to crash the ESP32 board and forces a restart