Hi folks! I have tried daisy-chaining the qwiic openlog and the qwiic scale on the same I2C line, and have run into problems. Each works fine when connected by themselves, but when they are both on the I2C line the qwiic openlog library examples lock up and won’t write to the sd card. Changing the I2C address doesn’t help. Any suggestions?
Hi auralgo,
I am going to try and test this myself to see if there are weird timing issues causing the problem but I have a few quick questions to get a better idea of your setup. First, what microcontroller do you have the Qwiic boards connected to? Also, can you try running [Example 9 to check which version of the Qwiic OpenLog firmware is on your board? Finally, can you share your code you are using with both boards? We cannot really help debug custom code but I can try running it here and see if I notice the same behavior and I might have some advice for troubleshooting.](SparkFun_Qwiic_OpenLog_Arduino_Library/examples/Example9_ReadVersion/Example9_ReadVersion.ino at main · sparkfun/SparkFun_Qwiic_OpenLog_Arduino_Library · GitHub)
I have made a customer sketch that should work. This is assuming that the i2c address for the OpenLog qwiic was changed using example 11 and that the new address is 0x1E:
#include <Wire.h>
#include “SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.h” // Click here to get the library: http://librarymanager/All#SparkFun_NAU7802
#include “SparkFun_Qwiic_OpenLog_Arduino_Library.h”
OpenLog myLog;
NAU7802 myScale; //Create instance of the NAU7802 class
void setup()
{
myLog.begin(0x1E);
Serial.begin(9600);
Serial.println(“Qwiic Scale Example”);
Wire.begin();
if (myScale.begin() == false)
{
Serial.println(“Scale not detected. Please check wiring. Freezing…”);
while (1);
}
Serial.println(“Scale detected!”);
myLog.syncFile();
}
void loop()
{
if(myScale.available() == true)
{
long currentReading = myScale.getReading();
Serial.print("Reading: ");
Serial.println(currentReading);
myLog.println(currentReading);
}
}
- I hope this helps.