arduino sd card module

#include <SPI.h>#include <SD.h>File myFile;void setup() {// Open serial communications and wait for port to open:Serial.begin(9600);while (!Serial) {; // wait for serial port to connect. Needed for native USB port only}Serial.print("Initializing SD card...");if (!SD.begin(10)) {Serial.println("initialization failed!");while (1);}Serial.println("initialization done.");// open the file. note that only one file can be open at a time,// so you have to close this one before opening another.myFile = SD.open("test.txt", FILE_WRITE);// if the file opened okay, write to it:if (myFile) {Serial.print("Writing to test.txt...");myFile.println("This is a test file :)");myFile.println("testing 1, 2, 3.");for (int i = 0; i < 20; i++) {myFile.println(i);}// close the file:myFile.close();Serial.println("done.");} else {// if the file didn't open, print an error:Serial.println("error opening test.txt");}}void loop() {// nothing happens after setup}

0
2
Awgiedawgie 440215 points

                                    /*Save temperature in SD/microSD card every hour with DS3231 + SD/microSD module + Arduinomodified on 15 Apr 2019by Mohammadreza Akbari @ Electropeakhttps://electropeak.com/learn/*/#include &lt;SPI.h&gt;#include &lt;SD.h&gt;#include &lt;Wire.h&gt;#include &quot;Sodaq_DS3231.h&quot;File myFile;DateTime now;int newHour = 0;int oldHour = 0;void save_temperature() {myFile = SD.open(&quot;temp.txt&quot;, FILE_WRITE);now = rtc.now();myFile.print(now.hour());myFile.print(&quot;:&quot;);myFile.print(now.minute());rtc.convertTemperature(); //convert current temperature into registersmyFile.print(&quot;,&quot;);myFile.println(rtc.getTemperature()); //read registers and save temperature on deg CmyFile.close();}void setup (){Wire.begin();rtc.begin();Serial.begin(9600);Serial.print(&quot;Initializing SD card...&quot;);if (!SD.begin(10)) {Serial.println(&quot;initialization failed!&quot;);while (1);}Serial.println(&quot;initialization done.&quot;);now = rtc.now();oldHour = now.hour();}void loop (){now = rtc.now();newHour = now.hour();if (oldHour != newHour) {save_temperature();oldHour = newHour;}}

0
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
arduino as sd card arduino sd card module interface to pc arduino sd card module to pc sd card module arduino library arduino sd card interface arduino add sd card write to sd card arduino arduino sdcard arduino sdcard reader arduino board sd card can i read sd card using arduino code card reader arduino project amazon arduino sd card reader arduino board with sd card reader? arduino card reader code read sd card from arduino leonardo sd card using arduino arduino write to sd card arduino using sd card without library SD card basics arduino sd card setup without module arduino arduino sd card tutorial without a module arduino sd card reader what level can they read micro sd card reader arduino arduino smart card reader arduino compatible sd card arduino credit card reader arduino sd card example sd card in arduino arduino micro sd card sd card arduino uno Arduino how to read sd card arduino with sd card module sd card arduino example sd card interface arduino sd card for arduino uno arduino access sd card how to formatted sd card using arduino sd card module how to format sd card using arduino sd card module how to format sd card that use in arduino sd card module how to insert sd card in sd card module arduino why we use sd card module with arduinop how to use sd card module with arduino aruino sd card module arduino card reader micro sd card module arduino arduino sd card library sdcard reader for arduino sd card library arduino read from sd card arduino arduino sd card reader current draw using sd card arduino sd card with arduino how to include sd card library in Arduino sd card reader Writing data on SD card with Arduino: write data on sd card arduino sd card arduino arduino sd micro sd arduino sd module arduino arduino wifi card how to put sd card in arduino nano arduino graphics card? use sd card with arduino read data from sd card arduino arduino micro sd microsd arduino saving to an SD card with arudino arduino with micro sd arduino nano micor sd read file arduino sd card code sd card with arduino with audio arduino write to micro sd sd card module arduino arduinosd module arduino us sd card connect sdcard to arduino arduino mega with sd card module connect sd card reader to arduino SD Card Shield Module For Arduino arduino micro micro sd module sd card reader module arduino with sd card how to use micro sd reader arduino arduino sd card how to connect the sd card to arduino arduino sd card reader module arduino sd module tutorial arduino sd module arduino sd card reader where to connect sd card on arduino Save data to sD card arduino arduino sd-module how to output data into sdcard arduino ide sd card for arduino sd card arduino connection how to create an arduino board that transfers data from a micro sd card to computer arduino microsd sd card with arduinpo sd card reader ardiuno arduino write card data arduino sd card tutorial arduino connect sd card to spi no module mh-sd card module arduino arduino sd card interrface arduino uno micro sd card arduino uno sd card arduino sd card save arduino as sd card reader how to store data from arduino to sd card connect sd card to arduino sd card adapter arduino code arduino nano write to sd card micro sd reader arduino save data to microsd card arduino sd card arduino module arduino micro sd module example 16gb sd card data logging in arduino ardiuno micro sd card test arduino storage module sd card reader arduino micro sd module arduino sd card module arduino sd card module
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source