0

Data Logging sketch for Mega
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Data Logging sketch for Mega

by adafruit_support_bill on Sun Nov 24, 2013 1:43 pm

But I had to wire the Mega's SCL & SDA to pins 5 & 4 of the logger and LCD shield to make them work, so is it not really compatible?

It is compatible if you plug it directly into the Mega. If the shield in between does not pass the SDA and SCL, you need to add jumpers.

but the interrupt on pin 3 does not work - it did with the UNO.

Not sure why that would be. The Mega does support interrupt 1 on Pin3: http://arduino.cc/en/Reference/AttachInterrupt

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by Spiney on Thu Nov 28, 2013 11:47 am

Thank you.
I copied these lines from somewhere when I first started using interrupts on the Uno. I saw recently on some code for a Mega that PCintPort:: was not used as a prefix. What does PCintPort do please? I can't find an explanation of :: either - what does that do please?

Code: Select all | TOGGLE FULL SIZE
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>

Code: Select all | TOGGLE FULL SIZE
 PCintPort::attachInterrupt(PIN, burpcount,RISING);
Spiney
 
Posts: 194
Joined: Mon Jul 09, 2012 6:35 am

Re: Data Logging sketch for Mega

by adafruit_support_bill on Thu Nov 28, 2013 9:00 pm

PCintPort is the pin change interrupt class. The :: notation is from C++ syntax. It is the "scope resolution operator"
http://www.programmingsimplified.com/cp ... n-operator

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by Spiney on Fri Nov 29, 2013 5:39 am

The attach interrupt link you gave me 2 replies ago has example code in which the "PCintPort::" is not present. It seems that it is therefore unnecessary?
I wonder if the presence of this prefix in my code is why the Mega doesn't see the interrupt. (I cannot easily try the mega in the project at the moment to find out.)
Spiney
 
Posts: 194
Joined: Mon Jul 09, 2012 6:35 am

Re: Data Logging sketch for Mega

by adafruit_support_bill on Fri Nov 29, 2013 7:47 am

The AttachInterrupt is for an external "hardware" interrupt, not a pin-change interrupt. PCINtPort is from the Pin-Change interrupt library.
http://www.geertlangereis.nl/Electronic ... ge_en.html

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by wilbs719 on Wed May 03, 2017 2:27 pm

I have an Arduino Uno R3 with a datalogger shield (new style, V2) and am getting an intermittent CHK fragmented file in Excel 2010 - Windows 7 - when I plug my SD card into my laptop. Do I have a goofy SD card or is there something I am doing wrong? Are there any good tutorials beyond the Adafruit documentation? I am using the light/temp example provided in the Adafruit documentation with a few extra variables for extra logging datas. Sometimes it works great and the error can occur in between sequential logging sessions, such re-loading code while adjusting serial monitor messages. Help!

wilbs719
 
Posts: 11
Joined: Sat Dec 31, 2016 2:52 pm

Re: Data Logging sketch for Mega

by adafruit_support_bill on Wed May 03, 2017 2:33 pm

the error can occur in between sequential logging sessions, such re-loading code while adjusting serial monitor messages.

If you start an upload while it is writing to a file the interrupted file write can result in a corrupted file.

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by Spiney on Sun Jun 18, 2017 6:37 am

Is this code still avaiable please? It does not appear as advertised.
The file is AdafruitMega20120329.zip located here http://code.google.com/p/beta-lib/downloads/list.
Spiney
 
Posts: 194
Joined: Mon Jul 09, 2012 6:35 am

Re: Data Logging sketch for Mega

by adafruit_support_bill on Sun Jun 18, 2017 7:20 am

Yes it is there. That link was posted more than 5 years ago, so it is now on page 2: https://code.google.com/archive/p/beta- ... ads?page=2

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by Spiney on Sun Jun 18, 2017 10:07 am

Thanks Bill. Sorry!
I have down loaded it and unzipped it, but thanks to my ignorance I can't find the sketch! Tips please.
Spiney
 
Posts: 194
Joined: Mon Jul 09, 2012 6:35 am

Re: Data Logging sketch for Mega

by adafruit_support_bill on Sun Jun 18, 2017 10:42 am

There are 3 library folders in that zip file. Inside each library folder is an 'examples' folder. All the example sketches are in the examples folders.

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by Spiney on Sun Jun 18, 2017 11:32 am

Thanks again Bill. I have got the sketch that I want - but it requires library files that I do not have installed. I see .h and .cpp files for those libraries but how and where do I add them? I suppose in Documents\Arduino\Libraries rather than in "program Files" but presumably I should not just copy .h and .cpp files into the libraries folder? Sorry again!
Spiney
 
Posts: 194
Joined: Mon Jul 09, 2012 6:35 am

Re: Data Logging sketch for Mega

by adafruit_support_bill on Sun Jun 18, 2017 11:34 am

You need to copy the whole library folder as described in this guide:
http://learn.adafruit.com/adafruit-all- ... nstall-use

adafruit_support_bill
 
Posts: 81290
Joined: Sat Feb 07, 2009 10:11 am

Re: Data Logging sketch for Mega

by Spiney on Sun Jun 18, 2017 12:16 pm

OK I have pasted the libraries but I get many errors when verifying, including twimaster, SdFat and RTC_Ds1307. I must leave this for the moment. I shall try hard wiring the Mega onto the logging shield and use my old code. I will come back again later if necessary. Thank you.
Spiney
 
Posts: 194
Joined: Mon Jul 09, 2012 6:35 am

Please be positive and constructive with your questions and comments.