Software:
1. Arduino IDE Click Here to Download
2. SD Card library Click Here to Download
Hardware:
1. Arduino Uno
2. SD card module
3. Serial to TTL logic converter
Arduino Code:
// SPI and SD libraries. SPI for connecting SD card to SPI bus.
#include <SPI.h>
#include <SD.h>
const int sdPin = 8;
byte byteRead;
// File variable
File tempsFile;
void setup() {
// Serial output for when connected to computer
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(sdPin)) {
Serial.println("initialization failed!");
return;
}
Serial.println("Initialization done.");
}
void loop() {
// Open SD card for writing
tempsFile = SD.open("SERIAL.csv", FILE_WRITE);
if (tempsFile) {
while(Serial.available()>0)
{
byteRead=Serial.read();
// write temps to SD card
tempsFile.write(byteRead);
// close the file
}
tempsFile.close();
}
}
Acknowledges for penmanship such a worthy column, I stumbled beside your blog besides predict a handful advise. I want your tone of manuscript... air monitor
ReplyDelete