Created
March 26, 2016 02:35
-
-
Save mcgodfrey/e82c455c8468f97db1b4 to your computer and use it in GitHub Desktop.
Log to SD function from homebrew temperature logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Logs current temperature data to SD card. | |
* Note that the global variable "filename" must be initialised | |
* File format is: | |
* datestring,sensor0_name,temp0,sensor1_name,temp1,sensor2_name,temp2 | |
* datestring,sensor0_name,temp0,sensor1_name,temp1,sensor2_name,temp2 | |
*/ | |
byte log_temps(char *date_str){ | |
File f = SD.open(filename, FILE_WRITE); | |
if(f) { | |
f.print(date_str); | |
for(byte a=0; a<num_sensors; a++){ | |
f.print(","); | |
f.print(probe_name_array[a]); | |
f.print(","); | |
f.print(temp_array[a]); | |
} | |
f.println(""); | |
f.close(); | |
}else{ | |
state=ERR; | |
error_code = ERROR_LOGGING; | |
} | |
return(ERROR_NONE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment