No sign of life in Serial Monitor

I am newer to the Arduino scene and have been trying to understand the Serial Monitor better.

I am using a Sparkfun SAMD21 Pro RF and tying to take in and interpolate some GPS data. I was seeing outputs in the serial monitor but then they stopped. Suspecting a problem, I loaded up some simple code as seen below:

static const int heartbeat = 4;

void setup() {
  Serial.begin(9600);
  pinMode( heartbeat, OUTPUT );
  }

void loop() {
  digitalWrite( heartbeat, HIGH);
  Serial.println("Hello");
  digitalWrite( heartbeat, LOW);
  delay(1000);
}

This simple code did not produce anything in the Monitor window. Because I see the LED blinking, I believe that Serial.println() function is being executed. Baud Rate was set to 9600 and drop down to 'No Line Ending'. Also restarted IDE.

Any help would be appreciated.

First things first, you’ll never see the LED blinking, because it’s HIGH, then immediately LOW… followed by your delay.

You could also add a print in setup() to see if the code actually starts.

Thanks for the suggestions,

The LED did blink before, albeit quickly and not at full brightness, but I added a delay to be sure. I also added a Serial.println() in the setup as suggested.

static const int heartbeat = 4;

void setup() {
  Serial.begin(9600);
   Serial.println("Hi");
  pinMode( heartbeat, OUTPUT );
  }

void loop() {
  digitalWrite( heartbeat, HIGH);
  Serial.println("Hello");
  delay(200);
  digitalWrite( heartbeat, LOW);
  delay(1000);
}

Unfortunately, still nothing in the Serial Monitor Window. I know there are some differences between a SAMD and an Arduino when it comes to certain libraries (SoftwareSerial.h). Wonder if that has any effect?

IF your Arduino is plugged into the USB on PC and if enumerated correctly by Windows OS, then device manager will "show" the enumerated COMx port number.
IF your ArduinoIDE is connected to the virtual COMx port, then There is NO reason a test sketch needs Software Serial.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  Sketch uses 2846 bytes (1%) of program storage space. Maximum is 253952 bytes.
  Global variables use 220 bytes (2%) of dynamic memory, leaving 7972 bytes for local variables. Maximum is 8192 bytes.
 */

#include <Streaming.h>        // requires library from http://arduiniana.org/libraries/streaming/
#define BOARD_LED_PIN 13      // Mega
#define BAUD          9600
#define ON_Time       750     // mS
#define OFF_Time      250

int n = 0;

void setup() {                
  // initialize the digital pin as an output.
  pinMode(BOARD_LED_PIN, OUTPUT);
  Serial.begin(BAUD);
  Serial << "Blink LED & count Demo" << "\n \r" << "by MRB" << "\n\r\n\r" ; 
}

void loop() {
  digitalWrite(BOARD_LED_PIN, HIGH);   // set the LED on
  delay(ON_Time);                      // wait
  digitalWrite(BOARD_LED_PIN, LOW);    // set the LED off
  delay(OFF_Time);                     // wait
  Serial << "Loop #: " << ++n << "\n\r" ;
}

Thanks for the feedback. I agree, this test sketch does not need the SoftwareSerial library. Just bringing it up as an example of how the SAMD21 is slightly different.

I fired up the code you supplied. Again, the programs seems to run fine with respect to the LED but still nothing on the Serial Monitor window. In the meantime I got a redownloaded IDE to no avail.

  • LED works
  • Serial does not, but
    -- Arduino sketch uploads and verifies

Thus, if you can program the Arduino board, USB must be enumerating on PC to a virtual COMx port. The Arduino USB circuitry must be OK.

CLOSE the IDE and reboot OS.
Attach Arduino to USB
Use another serial monitor program to test

Windows "serial" "terminal" "emulator" programs - Google Search

I like "termite"

and USBDeview I find invaluable for seeing what I have connected to my USB ports

1 Like

Add a while(!Serial); before your first print statement and see if that solves the issue.

Your board has native USB, that's the difference between the basic Arduinos like Uno and Mega and your board.

Found the issue.

Needed to replace Serial.println() with SerialUSB.println().

Thanks to those who tried to help.

Solution code:

static const int heartbeat = 4;

void setup() {
  Serial.begin(9600);
   SerialUSB.println("Hi");
  pinMode( heartbeat, OUTPUT );
  }

void loop() {
  digitalWrite( heartbeat, HIGH);
  SerialUSB.println("Hello");
  delay(200);
  digitalWrite( heartbeat, LOW);
  delay(1000);
}

I would fiddle a little more so you can get a better understanding. Replace Serial.begin by SerialUSB.begin and see what happens.

1 Like

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