Example for Arduino-Write Data

Last revision 2025/12/24

This article presents a comprehensive example of how to write data using Arduino and a Serial Data Logger, including hardware/software requirements, connection diagrams, and sample code.

Hardware Preparation

Software Preparation

Connection Diagram

Connection Diagram

Sample Code

Write data to the module through Serial.print, save a file every once in a while.

#define SPIN 6  //Connect to the module Pin S, trigger to save files at low level 
uint16_t i = 0;

void setup(void)
{
  Serial.begin(9600);
  delay(2000);  //To aviod data lost, delay a period of time to wait for the module to start 
  pinMode(SPIN, OUTPUT);
  digitalWrite(SPIN, HIGH);
}

void loop(void)
{
  Serial.println(String(i));
  i++;
  if((i % 10) == 0){
    digitalWrite(SPIN, LOW);
    delay(500);
    digitalWrite(SPIN, HIGH);
  }
  delay(300);
}

Was this article helpful?

TOP