SD Card (SPI mode) example

Hello everyone. I’m trying to connect a SD Module (SPI interface) with Zerynth because I need to make a kind of datalogger.
I saw the the Filesystem example, but some things are not clear to me.

ww =‘0:zerynth.txt’, ‘w+’).

  1. What is “w+”?
  2. When I need to append data in the end of file, I just need to call ww.write()?
  3. I need to call ww.close()? My device starts to save data when is powered on and only stops when is powered off. In order not to lose data, ww.write() is sufficiente?

Best regards,

Hi @Nysix
As for 1.this the mode to open the file, such as read/write/read and write…
‘W+’ is for read/write operations
2. after opening the file, Call seek method, to seek to the end of the file.
operating System docs.
3. looking at the example, you just need to call the write() method, It flushes the data immediately without waiting to close the file.

1 Like

@karimhamdy1 thank you a lot! Looks more simple than I thought.

Is there any library in Zerynth that will allow me to upload an SD file to a web server? Submit periodically the .txt file generated by my datalogger to my server where I could download it from anywhere would be very helpful.

I don’t think there is direct support by Zerynth for uploading files to a web server, but let me search some time if this could be done maybe using some other libraries in Zerynth.:smile: