I am attempting to collect data from the light and temperature sensor and write it to storage. I have successfully remounted the storage as writable, opened a file, and written some data.
All the code appears to work.
I use 'with open' and exception handling
I flush after every write.
When the program terminated, only a few lines of data are written.
However, when I remount the drive so that it is no read only, all the data appears.
To restate, when the program terminates the file is almost empty, with may a few lines when I open it, or 50 bytes written.
When I reboot the circuit playground express in the mode so I can write data from the computer, the entire file appears, 15-20 kilobytes.
Is there a way to explain this behavior?
Is there a way to force the device to display the data without rebooting the device?
If I try to read the data, will it be there? Eventually I want the program to analyze the data immediately and display some information on the LEDs. If the only way to get the data is to reboot the device, I will not be able to do this.
write data to storage
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: write data to storage
What programming language/environment are you using?
- rhcox1
- Posts: 3
- Joined: Fri Jul 06, 2018 4:00 am
Re: write data to storage
I am programming on a mac using python. I generally use mu to load and run the code, although I also load it directly to the mounted drive.
I have tried to run the code hooked up to a PC and the results are the same.
It could be that the reset itself makes the full file visible. If I don't change it to where it loads as writable on the PC, the device runs the code and overwrites the file.
I next will try to read the data after the file closes and see if it is in the device even though it does not appear on the computer
I have tried to run the code hooked up to a PC and the results are the same.
It could be that the reset itself makes the full file visible. If I don't change it to where it loads as writable on the PC, the device runs the code and overwrites the file.
I next will try to read the data after the file closes and see if it is in the device even though it does not appear on the computer
- rhcox1
- Posts: 3
- Joined: Fri Jul 06, 2018 4:00 am
Re: write data to storage
Additional note. The data is there and I can read it in the program and write it out to REPL. However, it still does not show up on the mounted drive until after reset.
So it is not as big an issue as it was. I can do what I want to do. I just wasted a lot of time thinking that the program was not working. If this is a common problem, it should be documented.
So it is not as big an issue as it was. I can do what I want to do. I just wasted a lot of time thinking that the program was not working. If this is a common problem, it should be documented.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: write data to storage
[moved to the CircuitPython forum]
- danhalbert
- Posts: 4650
- Joined: Tue Aug 08, 2017 12:37 pm
Re: write data to storage
The FInder in MacOS doesn't have an explicit "Refresh" or "Reload" button. It's not expecting files to magically appear on what appears to it to be an ordinary USB drive so it doesn't bother to check for new files. However, it seems that you can use the Back and Forward buttons to refresh the display: https://appsliced.co/ask/how-do-i-refre ... ow-in-os-x.
Windows and Mac have Refresh or Reload capability (e.g. F5 in Windows, and there's a refresh button as well).
I agree this should be documented, and I'll add something to the guide(s). Which guide were you using?
Windows and Mac have Refresh or Reload capability (e.g. F5 in Windows, and there's a refresh button as well).
I agree this should be documented, and I'll add something to the guide(s). Which guide were you using?
Please be positive and constructive with your questions and comments.