Mega 2560, older Adafruit Datalogger PID 1141 Compile Error

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ajohnsonlaird
 
Posts: 20
Joined: Fri Feb 13, 2015 1:14 am

Mega 2560, older Adafruit Datalogger PID 1141 Compile Error

Post by ajohnsonlaird »

EDIT: NOTE, I'M LEAVING THIS POSTING HERE AS A MONUMENT TO MY FOOLISHNESS.
There are TWO SD libraries!
One is in the Sketches folder and the other is (on a Mac) in /Applications/Arduino.app/Contents/Java/libraries/SD

You have two guesses as to which one I replaced. Hint: It was the one in /Applications.
Why?

On web page: https://learn.adafruit.com/adafruit-dat ... d-leonardo
It states:
First, find the "core libraries" folder - if you are using Windows or Linux, it will be in the folder that contains the Arduino executable, look for a libraries folder. Inside you will see an SD folder (inside that will be SD.cpp SD.h etc)

So, silly me....I reasoned that on the Mac I should also look in the folder (aka "Container" in Macspeak) for Arduino.app for a library called SD that has (in a subfolder called src), files SD.cpp, SD.h.
And sure enough those files are there.

Bottom line: On the Mac replace the SD folder in /Sketches/libraries/ and NOT in /Applications/Arduino.app/Contents/Java/libraries/SD.

When you change the correct SD library cardinfo works fine.

Admin: Feel free to delete this thread if it's appropriate to do so.
Cheers
Andy

---------- ORIGINAL POST-----




I'm trying to use one of the older Adafruit Datalogger shields, Product 1141 on a Mega 2560 R3 with IDE 1.8.19 running on a Mac under Big Sur.
I noted the web page that I had to change out the SD library for the Mega and did that.
I also noted the web page at https://learn.adafruit.com/adafruit-dat ... d-leonardo that provides instructions for the Mega and older Datalogger without the SPI port connection.

I followed the instructions specifically to see if I could get the cardinfo sketch to work. Specifically the instruction that says "The cardinfo sketch uses a lower level library to talk directly to the card, so it calls card.init() instead of SD.begin()." and then shows how to change the line:

Code: Select all

  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  while (!card.init(SPI_HALF_SPEED, chipSelect)) {
to read:

Code: Select all

  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  while (!card.init(SPI_HALF_SPEED, 10, 11, 12, 13)) {
I have two questions:
Question 1: The first is that in the cardinfo sketch line 50 has an if not a while (but I suspect this is of no great consequece):

Code: Select all

  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
Question 2: When I attempt to compile with the "new" code in place with the 10, 11, 12, 13 pins specified, there's an apparent problem with the Sd2Card class or a subclass, because I get the compile errors shown at the end of this posting -- the invocation signature doesn't match anything in the Sd2Card class/subclasses.

I realize that I may have to go "weed diving®" into the class library, but I reasoned I'm unlikely to be the first person with this problem and/or adafruit might take pity on me!

Anyone figured a workaround for this please? (Be gentle please, I'm an experienced systems programmer but new to Arduino/Mega/SD cards!) :)

Thanks in advance
Andy


Arduino: 1.8.19 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

/Users/andy/Dropbox/Arduino/Sketches/SDCardInfo/SDCardInfo/SDCardInfo.ino: In function 'void setup()':
SDCardInfo:50:48: error: no matching function for call to 'Sd2Card::init(const uint8_t&, int, int, int, int)'
if (!card.init(SPI_HALF_SPEED, 10, 11, 12, 13)) {
^
In file included from /Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/SdFat.h:29:0,
from /Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/SD.h:20,
from /Users/andy/Dropbox/Arduino/Sketches/SDCardInfo/SDCardInfo/SDCardInfo.ino:24:
/Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/Sd2Card.h:193:11: note: candidate: uint8_t Sd2Card::init()
uint8_t init(void) {
^~~~
/Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/Sd2Card.h:193:11: note: candidate expects 0 arguments, 5 provided
/Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/Sd2Card.h:201:11: note: candidate: uint8_t Sd2Card::init(uint8_t)
uint8_t init(uint8_t sckRateID) {
^~~~
/Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/Sd2Card.h:201:11: note: candidate expects 1 argument, 5 provided
/Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/Sd2Card.h:204:11: note: candidate: uint8_t Sd2Card::init(uint8_t, uint8_t)
uint8_t init(uint8_t sckRateID, uint8_t chipSelectPin);
^~~~
/Users/andy/Dropbox/Arduino/Sketches/libraries/SD/src/utility/Sd2Card.h:204:11: note: candidate expects 2 arguments, 5 provided
Multiple libraries were found for "SD.h"
Used: /Users/andy/Dropbox/Arduino/Sketches/libraries/SD
Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
exit status 1
no matching function for call to 'Sd2Card::init(const uint8_t&, int, int, int, int)'


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Last edited by ajohnsonlaird on Mon Feb 21, 2022 12:30 am, edited 2 times in total.

User avatar
ajohnsonlaird
 
Posts: 20
Joined: Fri Feb 13, 2015 1:14 am

Re: Mega 2560, older Adafruit Datalogger PID 1141 Compile Er

Post by ajohnsonlaird »

Oh....I forgot to mention that the RTC works fine!

Thanks
Andy

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”