/* * Datalogger Continuous Faludi * data is displayed continuously and stored upon request * by Rob Faludi www.faludi.com */ #define VERSION "1.00" #include #define SIZE 511 // number of samples to store (maximum 511) #define INTERVAL 500 // interval between readings, in milliseconds #define COUNTDOWN 0 // countdown before beginning, in milliseconds #define STORE_PIN 2 // momentary switch attached to ground #define RETREIVE_PIN 3 // momentary switch attached to ground #define CLEAR_PIN 4 // momentary switch attached to ground #define LED_PIN 13 unsigned long count=0; byte data[SIZE]; volatile boolean store = false, retrieve = false; void setup() { pinMode(STORE_PIN, INPUT); pinMode(RETREIVE_PIN, INPUT); pinMode(CLEAR_PIN, INPUT); pinMode(LED_PIN, OUTPUT); digitalWrite(STORE_PIN, HIGH); // enable internal pull-up resistor digitalWrite(RETREIVE_PIN, HIGH); // enable internal pull-up resistor digitalWrite(CLEAR_PIN, HIGH); // enable internal pull-up resistor blinkLED(LED_PIN, 2, 200); // blink the status LED twice Serial.begin(9600); // start serial output Serial.print("datalogger v"); Serial.println(VERSION); if (SIZE > 511) Serial.println("Error! SIZE cannot be greather than 511!"); for (int i=0; i