Leonardo Serial Monitor Showing Blank

I’m doing a project on a Microsoft Windows 10 and an Arduino Leonardo (connected to computer with usb). The serial monitor, which is set at 9600 baud, keeps turning up blank. In the project, I have connected a device to the RX and Ground pins of my Arduino. I know the USB works because the basic blink example works properly. Here is the code:

// Arduino Brain Library - Brain Serial Test

// Description: Grabs brain data from the serial RX pin and sends CSV out over the TX pin (Half duplex.)
// More info: https://github.com/kitschpatrol/Arduino-Brain-Library
// Author: Eric Mika, 2010 revised in 2014

#include <Brain.h>

// Set up the brain parser, pass it the hardware serial object you want to listen on.
Brain brain(Serial1);

void setup() {
// Start the hardware serial.
Serial.begin(9600);
}

void loop() {
// Expect packets about once per second.
// The .readCSV() function returns a string (well, char*) listing the most recent brain data, in the following format:
// “signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma”
if (brain.update()) {
Serial.println(brain.readErrors());
Serial.println(brain.readCSV());
}
}

First step is to put a Serial.print() into Setup to make sure that the Serial is working. The problem could simply be that brain.update is never being fired.

I think BJHenry gave good advice. I would like to add that you should add the following line before that Serial.print():

while (!Serial) {}

The reason is that the Leonardo (and similar boards) don't reset when you open Serial Monitor. That means that any serial output printed before you can open Serial Monitor will be lost.

Note that this code causes the sketch to hang in an infinite loop until you open Serial Monitor. For this reason, you would not want to use this sort of code when you are running the program without Serial Monitor open (such as when the Serial.print() is only done for debugging). In that case, you would want to comment out or otherwise disable that line when you are not using Serial Monitor.