ahmed ismail
Published © CERN-OHL

Export Data from Arduino to Excel Sheet

Have you ever wanted to make a system that records sensor readings for future analysis? If so, that's exactly what we're about to do.

BeginnerShowcase (no instructions)1 hour23,407
Export Data from Arduino to Excel Sheet

Things used in this project

Story

Read more

Schematics

Export data from arduino to excel sheet

Code

Export data from arduino to excel sheet

Arduino
/*

@title : Export data from arduino to excel

@author : Ahmed Ismail

@email : ahmed.ismail3115@gmail.com

@compiler : Arduino IDE

*/

#define CUSTOM_SETTINGS
#define INCLUDE_CLOCK_SHIELD
#define INCLUDE_DATA_LOGGER_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>

/* Define the ldr on pin A0. */
#define LDR A0

/* Define some variables for the time and ldr. */
int hour, minute, second, ldr;

/* Boolean to start logging. */
bool startFlag = false;

void setup(){

/* Start communication. */
  OneSheeld.begin();
   /* Save any previous logged values. */
  Logger.stop();
  /* Start the clock shield. */
  Clock.queryDateAndTime();
  
  }

  void loop(){

  /* Always get the  time. */
  hour = Clock.getHours();
  minute = Clock.getMinutes();  
  second = Clock.getSeconds();
  ldr = analogRead(LDR);

  /* check If the seconds reaches zero. */
  if (second == 0){
     /* First insure to save previous logged values. */
    Logger.stop();
     /* Set a delay. */
    OneSheeld.delay(500);
     /* Start logging in a new CSV file. */
    Logger.start("LDR values");
     /* Set startFlag. */
    startFlag = true;
    }

    
     /* Check logging started. */
  if(startFlag)
  {
  /* Add brightness level values as a column in the CSV file. */
    Logger.add("Brightness",ldr);
    
      Logger.log();  
    /* Delay for  2 seconds. */
    OneSheeld.delay(2000);
     }
  }

Credits

ahmed ismail

ahmed ismail

2 projects • 79 followers
Maker

Comments