My project:
Arduino Uno WiFi Rev2 (Bottom of stack)
Grove base shield V2 (Middle of stack)
Seeed SD Card Shield (Top of stack)
Grove 6 Axis Accelerometer & Gyroscope, connected to base shield via I2C port.
I am brand new to this and this is my first project. I seem to be stuck again. I can connect to the internet and read the sensor values in the serial monitor. Now I am trying to write my accelerometer values to my sd card. I cannot seem to get the string syntax correct to write to the card. Any suggestions of what I am doing wrong?
Please don't post pictures of text. That is very unhelpful.
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the forum toolbar).
Sorry about that. Thank you again for the direction. When I try and post the actual error it tells me I have gone over the allowed length (9000 characters). Should I post it in a text file?
MadTinker1407:
When I try and post the actual error it tells me I have gone over the allowed length (9000 characters). Should I post it in a text file?
Yes, please. If you click the "Reply" button here, you will see an "Attachments and other settings" link.
I'm pretty confused on this so bear with me. I can see the myIMU.readFloatAccelX data in my serial monitor. I understand the Serial.print command sends the data to the serial monitor. It's exactly the way I need it in the serial monitor. I am just trying to write that to a file now on an SD card. I can open and write to a file using the Datalogger example provided so I know that the SD card is working. Maybe I don't need to be using a String command to write the data to a file. I was just trying to follow the Datalogger example. If there is another way please let me know.
Regarding the errors when compiling your sketch, you have an extra closing brace near the start of your printData function, which causes the rest of the code intended to be inside that function to be not in any function, which is not allowed.
A very helpful troubleshooting tool is the Auto Format feature (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor). If you do an Auto Format and then compare the resulting indentation to your intended program structure, it will quickly point you to where there is a missing or extra brace. In your current code, you will notice all the lines at the end of the program have one less level of indentation than you would expect for code inside a function.
Another useful feature of the Arduino IDE/Arduino Web Editor is that when you place the cursor next to one bracket, it puts a box around the matching bracket. In the Arduino IDE, if the cursor is next to the closing bracket and the opening bracket is off the screen then it will show the opening bracket line in a tool tip after a short delay.
pert:
Regarding the errors when compiling your sketch, you have an extra closing brace near the start of your printData function, which causes the rest of the code intended to be inside that function to be not in any function, which is not allowed.
Thank you, those were very helpful tips I was not aware of. I will save your text so I don't forget those. I found the offending bracket.
Juraj:
off topic question. what for is the Base shield if SD card shield has I2C Grove connector?
I bought it before I bought the SD card shield. I just left it on there and stacked. The final goal is to print to a cloud server through WiFi. The SD card was a last minute attempt to collect some data.