Hardware Reference
In-Depth Information
//Read the configuration information (speed.txt)
File commandFile = SD.open("speed.txt");
if (commandFile)
{
Serial.println(F("Reading Command File"));
while(commandFile.available())
{
refresh_rate = commandFile.parseInt();
}
Serial.print(F("Refresh Rate = "));
Serial.print(refresh_rate);
Serial.println(F("ms"));
commandFile.close();
}
else
{
Serial.println(F("Could not read command file."));
return;
}
//Write column headers
File dataFile = SD.open("log.csv", FILE_WRITE);
if (dataFile)
{
dataFile.println(F("\nNew Log Started!"));
dataFile.println(F("Date,Time,Phrase"));
dataFile.close(); //Data isn't actually written until we
//close the connection!
//Print same thing to the screen for debugging
Serial.println(F("\nNew Log Started!"));
Serial.println(F("Date,Time,Phrase"));
}
else
{
Serial.println(F("Couldn't open log file"));
}
}
void loop()
{
//Get the current date and time info and store in strings
DateTime datetime = RTC.now();
year = String(datetime.year(), DEC);
month = String(datetime.month(), DEC);
day = String(datetime.day(), DEC);
hour = String(datetime.hour(), DEC);
minute = String(datetime.minute(), DEC);
Search WWH ::




Custom Search