Using 2 Single QWIIC Relays

I would like to use 2 Single QWIIC relays. I have changed the address of one of the relays. The change works great. My question - How do I code to change the states of each relay? I’m not sure what code to write to make each relay turn on. I really don’t want to use a quad relay because 2 of the relays will go unused. Thanks.

There’s some example code in the [hookup guide, it’s pretty simple to do with our library.

To turn the relay on send:

relay.turnRelayOn();

To turn the relay off send:

relay.turnRelayOff();

You will need to modify the code a bit for 2 relays, but start with just getting one running first.](https://learn.sparkfun.com/tutorials/qwiic-single-relay-hookup-guide)

Sure. I understand how to turn one on. My question. - How do I distinguish the two relays when trying to turn each one on?

You have to assign one relay to one I2C address and the second to another.

Qwiic_Relay relay1(0x18);
Qwiic_Relay relay2(0x19):

Once you’ve done that, one relay becomes ‘relay1’ and the other becomes ‘relay2’.

  // Let's turn on relay1...
  relay1.turnRelayOn(); 
  delay(500);
  // Let's turn that relay off...
  relay1.turnRelayOff(); 
  delay(500);

  // Let's turn on the relay...
  relay2.turnRelayOn(); 
  delay(500);
  // Let's turn that relay off...
  relay2.turnRelayOff(); 
  delay(500);

Awesome! Thank you so much.

C Henderson