Skip to main content
added 806 characters in body
Source Link
201
  • 37
  • 1
  • 5

I want to classify my data from 3 sensors with arduino so that every time i enter the specific date or hour, or also it can be a period of time like 10 days ago, it shows me the exact data. In other word i want to classify my data so that whenever i want every detail of data, i would be able to get it by entering the information of year,date,time. I also didn't want my data to be in separate files and time stamps. I want to be able to do that within one file and search inside that file...

#include "RTClib.h"
#include <SD.h>
#include <SPI.h>

RTC_DS1307 rtc;
const int chipSelect = 10;

File dataFile;

String print_time(DateTime timestamp) {
  char message[120];

  int Year = timestamp.year();
  int Month = timestamp.month();
  int Day = timestamp.day();
  int Hour = timestamp.hour();    
int Minute = timestamp.minute();
      int Second= timestamp.second();
    
      sprintf(message, "%d-%d-%d %02d:%02d:%02d", Month,Day,Year,Hour,Minute,Second);
    
      return message;
    }
    
    void setup(){
      Serial.begin(9600);
    
      pinMode(chipSelect, OUTPUT);
      if (!SD.begin(chipSelect)){
        Serial.println("Error: SD card would not initiate.");
      }
    
      rtc.begin();
      if (!rtc.isrunning()){
        Serial.println("Clock is not running");
      }
    
      dataFile = SD.open("log0.csv", FILE_WRITE);
      if (!dataFile){
        Serial.println("Could not open file.");
      }
    
    }
    
    void loop(){
      Datetime now = rtc.now();
      dataFile.println(print_time(now));
    
      delay(3000);
    }

I want to classify my data from 3 sensors with arduino so that every time i enter the specific date or hour, or also it can be a period of time like 10 days ago, it shows me the exact data. In other word i want to classify my data so that whenever i want every detail of data, i would be able to get it by entering the information of year,date,time. I also didn't want my data to be in separate files and time stamps. I want to be able to do that within one file and search inside that file...

I want to classify my data from 3 sensors with arduino so that every time i enter the specific date or hour, or also it can be a period of time like 10 days ago, it shows me the exact data. In other word i want to classify my data so that whenever i want every detail of data, i would be able to get it by entering the information of year,date,time. I also didn't want my data to be in separate files and time stamps. I want to be able to do that within one file and search inside that file...

#include "RTClib.h"
#include <SD.h>
#include <SPI.h>

RTC_DS1307 rtc;
const int chipSelect = 10;

File dataFile;

String print_time(DateTime timestamp) {
  char message[120];

  int Year = timestamp.year();
  int Month = timestamp.month();
  int Day = timestamp.day();
  int Hour = timestamp.hour();    
int Minute = timestamp.minute();
      int Second= timestamp.second();
    
      sprintf(message, "%d-%d-%d %02d:%02d:%02d", Month,Day,Year,Hour,Minute,Second);
    
      return message;
    }
    
    void setup(){
      Serial.begin(9600);
    
      pinMode(chipSelect, OUTPUT);
      if (!SD.begin(chipSelect)){
        Serial.println("Error: SD card would not initiate.");
      }
    
      rtc.begin();
      if (!rtc.isrunning()){
        Serial.println("Clock is not running");
      }
    
      dataFile = SD.open("log0.csv", FILE_WRITE);
      if (!dataFile){
        Serial.println("Could not open file.");
      }
    
    }
    
    void loop(){
      Datetime now = rtc.now();
      dataFile.println(print_time(now));
    
      delay(3000);
    }
Source Link
201
  • 37
  • 1
  • 5

data classification with arduino

I want to classify my data from 3 sensors with arduino so that every time i enter the specific date or hour, or also it can be a period of time like 10 days ago, it shows me the exact data. In other word i want to classify my data so that whenever i want every detail of data, i would be able to get it by entering the information of year,date,time. I also didn't want my data to be in separate files and time stamps. I want to be able to do that within one file and search inside that file...