The pico has 2MB of local memory that can be used for data and program storage. One online resource states the maximum file size is 128KB and going over that corrupts the file; however, I have recorded 481KB files successfully. The files are accessible in the Thonny editor and can be copied to the local computer. Developing this for hourly recording of a remote stream to know high it rises after storms. Sleep for an hour, wake up, record a measurement and go back to sleep for another hour. Come back a month later to collect data.
Commands
gage_data = open(“gage_height”,”w”) #create file for writing or “a” for appending. Append will create the file if is not already there
gage_data.write(“height”) #writes data to file buffer. Does not write to memory yet. If it’s not a clean shutdown, the buffer is lost.
gage_data.flush() #writes buffer to memory. Not needed if you close the file.
gage_data.close() #writes buffer to memory and closes file
Insert commas in the write string to create CSV file for spreadsheet import.