Closed eziya closed 7 years ago
Hi,
I used Serial.readString() method to receive string message from string monitor. but it returns empty string.
#include "Arduino.h" #include "FreeRTOS_AVR.h" void setup() { Serial.begin(9600); xTaskCreate(vTaskSerial, NULL, configMINIMAL_STACK_SIZE, NULL, 2, NULL); vTaskStartScheduler(); while(1); } void vTaskSerial(void *pvParameters) { while(1) { if(Serial.available() > 0) { Serial.println("Serial is available"); String msg = Serial.readString(); Serial.println(msg); Serial.println("Message printing ends"); } vTaskDelay(100 / portTICK_PERIOD_MS); } } void loop() { }
>>Send to COM3: "hello"<< Serial is available Message printing ends
Strings use dynamic memory so probably won't work in a thread.
I think there are other ports of FreeRTOS to Arduino so you might try them.
Hi,
I used Serial.readString() method to receive string message from string monitor. but it returns empty string.