I am trying to connect two Qwiic LEDs to RedBoard Qwiic and I encounter few issues:
-The 2nd led does not respond (Qwiic LED Stick 2 failed to begin. Please check wiring and try again!). How can I activate it?
The leds does not light up. In most of the examples you wrote everything in the setup but I wonder can it be written in the loop (like in example02)?
#include <Wire.h>
#include "Qwiic_LED_Stick.h" // Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_LED_Stick
LED LEDStick1; //Create an object of the LED class
LED LEDStick2; //Create an object of the LED class
void setup() {
Wire.begin();
Serial.begin(115200);
//Start up communication with the LED Stick 1
if (LEDStick1.begin() == false) {
Serial.println("Qwiic LED Stick 1 failed to begin. Please check wiring and try again!");
while (1)
;
}
Serial.println("Qwiic LED Stick 1 ready!");
//Set the whole 1st LED Stick dim white
//First, turn all LEDs off
//Start up communication with another LED Stick 2 at address 0x29
if (LEDStick2.begin(0x29) == false) {
Serial.println("Qwiic LED Stick 2 failed to begin. Please check wiring and try again!");
while (1)
;
}
Serial.println("Qwiic LED Stick 2 ready!");
}
void loop() {
LEDStick1.LEDOff();
delay(500); //Wait for settings to be updated
LEDStick1.setLEDBrightness(100);
//Set the whole 1st LED Stick to White
LEDStick1.setLEDColor(255, 255, 255);
LEDStick2.LEDOff();
delay(500); //Wait for settings to be updated
//Set the whole 2nd LED Stick to Red
LEDStick2.setLEDColor(255, 0, 0);
}
Did you actually change the I2C address on the 2nd Qwiic LED Stick to 0x29 like in [example 10? (be sure only the one you want to change is connected when you run that).
Tried this with no respond at all for the LEDs. Any help will be welcome
#include <Wire.h>
#include "Qwiic_LED_Stick.h" // Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_LED_Stick
LED LEDStick1; //Create an object of the LED class
LED LEDStick2; //Create an object of the LED class
int currentAddress = 0x23;
int newAddress = 0x29;
void setup() {
Wire.begin();
Serial.begin(115200);
//Start up communication with the LED Stick 1
if (LEDStick1.begin() == false) {
Serial.println("Qwiic LED Stick 1 failed to begin. Please check wiring and try again!");
while (1)
;
}
Serial.println("Qwiic LED Stick 1 ready!");
//Set the whole 1st LED Stick dim white
//First, turn all LEDs off
//Start up communication with another LED Stick 2 at address 0x29
if (LEDStick2.begin(0x29) == false) {
Serial.println("Qwiic LED Stick 2 failed to begin. Please check wiring and try again!");
while (1)
}
//Change the address of the LEDStick
//First, check that the address is valid
if (newAddress > 0x08 && newAddress < 0x77) {
Serial.println("Address is valid.");
Serial.print("Attempting to set the device address to 0x");
Serial.println(newAddress, HEX);
Serial.println();
if (LEDStick2.changeAddress(newAddress) == true) {
Serial.println("I2C address change successful!");
Serial.println();
}
Serial.println("Qwiic LED Stick 2 ready!");
LEDStick1.LEDOff();
delay(500); //Wait for settings to be updated
LEDStick1.setLEDBrightness(100);
//Set the whole 2nd LED Stick to White
LEDStick1.setLEDColor(255, 0, 255);
LEDStick2.LEDOff();
delay(500); //Wait for settings to be updated
//Set the whole 2nd LED Stick to Red
LEDStick2.setLEDColor(255, 0, 0);
}}
void loop() {
}
Hence my proposal to download the I2C scanner sketch (many of them). Connect first one of the led’s and let it be scanned and detected. Now connect the other led and do the same.
If the addresses are the same, it will not work. In the case follow the earlier post from jfbauer. Change the address for one of the led’s to something else e.g. 0x23.
if the addresses are different, at least you know the led is working on I2C and have confirmed addresses.