Closed lemorage closed 4 months ago
Thanks for the link @qfisch
Can u also share some ideas on why this odd error will happen when the errorToString
function is not commented out? I am completely using the same code from the example usage.
Yes, exactly the same code as I showed above. And actually what I've done was just combine the example code of both (from SD module and SensirionI2CScd4x module).
The weirdest thing is I cannot observe any error msg from the serial monitor. The program just didn't print anything, which looked like it was stuck. Sometimes, it kept printing Initializing SD card...
again and again. After removing the errorToString
lines, it prints everything normally (all the data from the sensor). But I just can't see there is anything wrong with the call of errorToString
function here. I'm kind of stuck.
Can you test with the stock example from this repo ? without anything related to your sd card.
Are u referring to this example? I've tried the example from this repo, without anything related to sd card, and it works perfectly. Also, I've tried the example from the sd card repo, and it goes very well.
Okay. it could be that your board is running out of memory.
You could try reducing the size allocated to the error message char errorMsg[16];
Sure. I'll try that later after my board is idle. Thank you for your patience and instructions.
First of all, I try to find the implementation details of the function
errorToString
, which is used in the example usage program. But I can't find it. I think there is something wrong with this function, and the reason is as follows...I connected a Micro SD Card Adapter (which has an SD card in it) and an SCD41 sensor with the Arduino Uno board, and I confirmed all the wires were correctly connected. I tried to run the program below but failed. Only after I commented out the two lines
errorToString(error, errorMsg, 256);
, the program ran smoothly. I was shocked, but I couldn't find the reason. I hope someone who has the same devices can try the program below, and I wonder if you will find the same error as me. I am very free to talk with you about this very odd bug, which has confused me for three days.(p.s. Plus, I can confirm this odd error only happens when we want to read data from the sensor scd41 and write it to the sd card. If we only read it or write it, this would be completely fine.)