MEGA 2560 Data-logger v1.2.1 and NEW IDE

Hello Arduino!

It is currently 1:00 AM on my birthday, but I wanted to share this because I just finished it. I have made many data acquisition systems and this is one of the best. After learning some tricks, I was able to add the ability to read 4 sensors (instead of 3), improved readability, and better error-trapping to avoid resetting on an error. I did all of this while still managing to shave off almost 300 lines of code, saving 638 bytes of program space, and only adding 167 to the dynamic memory. Basically, its a better data logger than my others while being (mostly) more compact, and smaller with more functionality all while maintaining readability and a vast array of options to toy with in the code.

To make it easy to have standard intervals for samples (1, 3, 5, and 10 second sample rates) I made a timing chart. There is a variable near the top of the code "OP_DELAY" and you can adjust that value to make convenient rates.

NOTE:
This does not require serial UNLESS you add a 330 ohm resistor across pins 6 and 9.

Timing Chart:

1 Cycle, TX_FLASHER, No SD 0.498 Seconds per Cycle

--THESE VALUES ARE APPROX. AND BASED OFF THE SETTINGS ABOVE--

Sample Rate OP_DELAY's Value
fast as possible 0
every 1 second 502
every 3 seconds 2502
every 5 seconds 4502
every 10 seconds 9502


1 Cycle, TX_FLASHER, SAVE_FLASHER, SD Card 1.009 Seconds per Cycle

--THESE VALUES ARE APPROX. AND BASED OFF THE SETTINGS ABOVE--

Sample Rate OP_DELAY's Value
fast as possible 0
every 1 second 0 (close enough to 1 second)
every 3 seconds 1991
every 5 seconds 3991
every 10 seconds 8991


I figured I would add these to help make standard sample rates a little easier to make.

If you have any questions about this project or any other, PM me.

By The Way:
For more advanced users, I found a much better IDE option based off of Visual Studio.
Its Atmel's own IDE and there is an attachment that makes it work great with Arduino.

Atmel's IDE: Atmel Studio 7

Arduino Plugin for IDE: Plugin
Just click the second download box, the one labeled "Atmel Studio Gallery - Download for Atmel Studio 7"

Datalogger_v1.2.1.ino (10.1 KB)