Comments (4)
It looks like we got it working by opening the file in the setup and leaving it open in the task. IE, the file should already be opened by the time the task gets a hold of it.
from arduino_freertos_library.
I can confirm,
If I run the following piece of code I can write to the SD Card. If I run it in a task, it will create the text file, however it will not write anything to it.
File myBaro = SD.open("test.txt", FILE_WRITE);
baro.readBaro();
Serial.println(baro.getPressure());
myBaro.println("This should be working.");
myBaro.println(baro.getPressure());
delay(200);
myBaro.close();
Again, in setup it works 100%, but in a task for whatever reason it will not write to the SD Card.
from arduino_freertos_library.
I've had a quick look at this, and the Serial() class is used for writing text to the SD card.
There is a known issue with the Serial() class library. See issue #3. This same issue is probably occurring.
Serial.print("Sensor Value: "); \\ Correctly prints the text "Sensor Value: "
Serial.println(sensorValue); \\ just a blank, but newline & CR are printed.
I'm still trying to figure out what is the underlying cause of entanglement. My suspicion is that it is to do with namespace and variable declaration.
from arduino_freertos_library.
That's good to hear.
I'm certain there is a String() class issue underlying this issue though.
The only avenue I have to investigate is the potential for a variable declaration / freeing issue in the difference between the Arduino implementation, where setup() and loop() are both called by the main() function and hence may have corresponding variable space, and the FreeRTOS case where main() is never called directly. But, I haven't nailed down anything concrete yet.
I've done a bit of investigation, and it seems necessary to declare Strings as Global variables, otherwise they get allocated each time the Task for() loop is run, and then reserve() space for them, to prevent reallocation. Also, conversion of int to String seems somehow problematic.
Some working code is here, on Issue #3, for reference.
from arduino_freertos_library.
Related Issues (20)
- STM32FreeRTOS myservo can not work. HOT 2
- what is the difference of three freertos? HOT 5
- FreeRTOS automatically restarts after the last task has finished on Arduino Mega 2560 HOT 7
- vTaskDelay not functioning as expected in setup HOT 3
- Is it possible to implement a system timer interrupt version (rather than WDT) compatible with Arduino IDE? HOT 2
- Generic device support HOT 3
- RTOS Example Compile Error HOT 4
- Where is the define of TaskControlBlock_t in task.h? HOT 1
- define delay() to vTaskDelay() HOT 3
- Arduino delay() changed its behavior to not do busy wait anymore HOT 19
- INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil && avr/io.h: No such file or directory HOT 3
- Arduino Due support HOT 4
- lgt8f328p compatibility HOT 22
- Arduino R4 HOT 5
- [Q] Unable to change FreeRTOSConfig.h for a single sketch on Arduino IDE 2.2.1 HOT 1
- Casting error on vPortDelay function
- Array Queue HOT 1
- Teensy support HOT 4
- FAQ (for anyone who wishes to ask..) HOT 5
- Support for AWS FreeRTOS ESP32 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino_freertos_library.