I’m using a Sublime Text project, trying to build a test program for my Teensy 4.0. The code below fails to compile because Serial
is undeclared, and I can’t seem to find anywhere what header I need to include to get that declaration.
#include <Arduino.h>
void setup() {
digitalWrite(13, 1); // Turn on the LED so I can see that the board is powered
Serial.begin(9600);
while (!Serial);
Serial.println("Monitor connected");
}
void loop() {
if (Serial.available()) Serial.write(Serial.read());
}
I also tried Serial1, to see if it was only the USB serial port that didn’t work, but that was also an undeclared identifier. I’m coming from Teensyduino, which doesn’t require any header to access the serial ports, but I wanted to try PlatformIO because the serial monitor doesn’t seem to work in Teensyduino. Can anyone please tell me how to expose the serial ports?