Monitor does not show data

Hello.
The monitor in Arduino IDE is not working. It shows nothing. I also pasted a sample code from the Internet but nothing happens.
I tried searching for the solutions but nothing changed:

  1. Replace Serial.println() with SerialUSB.println()
  2. Check the baud rate.
    I also have trouble with WiFi101 / WiFiNINA Firmware Updater. Is this problem because of that?
    Here my code:
#include <Arduino_FreeRTOS.h>
#include <task.h>

TaskHandle_t TaskHandle_1;
TaskHandle_t TaskHandle_2;

void setup() {
   Serial.begin(9600);
   xTaskCreate(Task1, "Task1", 128, NULL, 2,  &TaskHandle_1);
   xTaskCreate(Task2, "Task2", 128, NULL, 1, &TaskHandle_2);
   vTaskStartScheduler();
 }
 
 void loop() {}
 
 void Task1(void *pvParameters)
 {
   for (;;)
   {
     SerialUSB.println("Task1 is running and about to raise Task2 priority.");
     vTaskPrioritySet(TaskHandle_2, uxTaskPriorityGet(NULL) + 1); 
   }
 }
 
 void Task2(void *pvParameters)
 {
   for (;;)
   {
     SerialUSB.println("Task2 is running and about to lower Task2 priority.");
     vTaskPrioritySet(TaskHandle_2, uxTaskPriorityGet(NULL) - 2);
   }
 }

It might help if you tell us which board you're using.

Does below code print anything?

void setup()
{
  Serial.begin(9600);
  while(!Serial);

  Serial.println(F("Arduino"));
}

void loop()
{
  Serial.println(F("hello world"));
  delay(1000);
}

Whether you should use Serial or SerialUSB depends what type of Arduino you are using, but whatever it is, you need to be consistent. You can't use SerialUSB.println() if you have not also used SerialUSB.begin().

if you are using hardware resources like Serial (or SerialUSB...) in several tasks, you might need to block / release (take/give) the resource using a semaphore. Otherwise your might be printing garbish.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.