Edit: This may have failed because of a deviceOS/build version mismatch, testing now.
Original Post:
I’m new to using the onboard flash storage. Eventually I want to be able to log while offline and then dump files to serial or OTA.
My first attempt failed. I have trimmed the code to a simple example where the Argon’s onboard LED D7 should be lit if I get a valid file descriptor from open() but it doesn’t succeed:
#include <fcntl.h>
const pin_t LED = D7;
void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
}
void loop() {
int fd = open("test.txt", O_RDWR | O_CREAT | O_TRUNC);
if (fd != -1) {
digitalWrite(LED, HIGH);
close(fd);
}
delay(3000);
}
Help? Or does anyone have an example of working POSIX file system code?
I am using an Argon and have tried with DeviceOS 2.2.0-rc1, 2.1.0 and 3.1.0 with the same result.