Source: https://mokxi.com/errors/serial1-was-not-declared
Updated: 2026-11-16

Home / Errors
Arduino build error

# error: 'Serial1' was not declared in this scope

An Arduino Uno or Nano has one hardware serial port, called Serial, shared with the USB cable. Serial1, Serial2 and Serial3 exist on bigger boards only.

Try the fixed sketch in Mokxi See the causes

- Build error
- 2 common causes
- Seen 1,904 times in failed builds on Mokxi in the 30 days to November 16, 2026.

The message

## What the Arduino IDE prints

Output window

The board you picked has no such port, so the name is unknown. Use a software serial port, or a board that has more.

Mokxi's compiler, clang, words it as use of undeclared identifier 'Serial1', and suggests Serial.

Causes

## The 2 usual causes with the fix

### 1Serial1 on an Uno or Nano

The SoftwareSerial library makes a second port on any two pins. It is slower and cannot send and receive at once at high speed, which is fine for a GPS or a Bluetooth module.

Broken

Fixed

Mokxi’s build tab says: This board has no Serial1: its one hardware serial port is Serial.

Try this fix in Mokxi

### 2Serial3 on a board that has fewer ports

The Arduino Mega 2560 has Serial, Serial1, Serial2 and Serial3. If the project needs several hardware ports, choose the Mega.

Broken

Fixed

Mokxi’s build tab says: This board has no Serial3: its one hardware serial port is Serial.

Try this fix in Mokxi

FAQ

## Questions and answers

### Which boards have Serial1?

The Mega 2560, the Leonardo and Micro, the ESP32, the Pico and many others. The Uno and Nano do not.

### Can I use pins 0 and 1 for a second port?

Those pins are the same port as Serial, so a module there fights with the USB cable. Use SoftwareSerial on other pins.

### Does SoftwareSerial have limits?

It listens on one port at a time and drops bytes above about 57600 baud on an Uno. Use a lower speed.

Next

## More errors and the longer guide

- error: 'ledPin' was not declared in this scope
- error: 'Servo' does not name a type

The longer guide to "was not declared" All Arduino errors
