Serial1 was not declared in this scope.

Trying to use this code to connect the uno board to an app, but the code supplied doesn’t want to compile.

/*
ARDUINO CONTROLLED ROBOT v1.0

/Arduino Motor Shield/
const int MotorR = 13; // H bridge control Input
const int MotorL = 12; // H bridge control Input
const int BrakeR = 9;
const int BrakeL = 8;
// SDA = 2
// SCL = 3
const int pwm_L = 5; // pwm output
const int pwm_R = 11; // pwm output
long pwmLvalue = 255;
long pwmRvalue = 255;
byte pwmChannel;
const char startOfNumberDelimiter = ‘<’;
const char endOfNumberDelimiter = ‘>’;

void setup(){
Serial1.begin(115200); // Bluetooth Baudrate

//Setup Channel A - RIGHT MOTOR
pinMode(MotorR, OUTPUT); //Initiates Motor Channel A pin
pinMode(BrakeR, OUTPUT); //Initiates Brake Channel A pin

//Setup Channel B - LEFT MOTOR
pinMode(MotorL, OUTPUT); //Initiates Motor Channel B pin
pinMode(BrakeL, OUTPUT); //Initiates Brake Channel B pin
Wire.begin();

while (!Serial1) {
; // wait for serial port to connect. Needed for Leonardo only
}
}// void setup()

void loop(){
int i = 0;
if (Serial1.available()) {
processInput();
}
}// void loop()

void processInput (){
static long receivedNumber = 0;
static boolean negative = false;
byte c = Serial1.read ();

switch (c){
case endOfNumberDelimiter:
if (negative)
SetPWM(- receivedNumber, pwmChannel);
else
SetPWM(receivedNumber, pwmChannel);

// fall through to start a new number
case startOfNumberDelimiter:
receivedNumber = 0;
negative = false;
pwmChannel = 0;
break;

case ‘g’: // robot GO!
go_Robot();
break;

case ‘f’: // Go FORWARD
go_Forward(255);
break;

case ‘b’: // Go BACK
go_Backwad(255);
break;

case ‘r’:
turn_Right(255);
//Serial.write(“right”);
break;

case ‘l’:
turn_Left(255);
//Serial.write(“left”);
break;

case ‘s’:
stop_Robot();
break;

case ‘x’:
pwmChannel = 1; // pwm_R
//Serial.write("pwm_R ");
break;
case ‘y’: // pwm_L
pwmChannel = 2;
//Serial.write("pwm_L ");
break;

case ‘0’ … ‘9’:
receivedNumber *= 10;
receivedNumber += c - ‘0’;
break;

case ‘-’:
negative = true;
break;

case ‘c’:
//setProgramNumber(0);
break;

} // end of switch
} // end of processInput

void go_Robot(){
digitalWrite(BrakeR, LOW); //Disable Motor R Brake
digitalWrite(BrakeL, LOW); //Disable Motor L Brake
//Motor A forward
digitalWrite(MotorR, HIGH); //Establishes forward direction of Channel A
analogWrite(pwm_R, pwmRvalue);
//Motor B forward
digitalWrite(MotorL, HIGH); //Establishes forward direction of Channel B
analogWrite(pwm_L, pwmLvalue);
}// void go_Robot()

void go_Forward(int mspeed){
digitalWrite(BrakeR, LOW); //Disable Motor R Brake
digitalWrite(BrakeL, LOW); //Disable Motor L Brake
//Motor A forward mspeed full speed
digitalWrite(MotorR, HIGH); //Establishes forward direction of Channel A
analogWrite(pwm_R, mspeed); //Spins the motor on Channel A at full speed
//Motor B forward mspeed full speed
digitalWrite(MotorL, HIGH); //Establishes forward direction of Channel B
analogWrite(pwm_L, mspeed); //Spins the motor on Channel B at full speed
}// void goForward(int mspeed, int time_ms)

void go_Backwad(int mspeed){
digitalWrite(BrakeR, LOW); //Disable Motor R Brake
digitalWrite(BrakeL, LOW); //Disable Motor L Brake
//Motor A forward mspeed full speed
digitalWrite(MotorR, LOW); //Establishes backward direction of Channel A
analogWrite(pwm_R, mspeed);//Spins the motor on Channel A at full speed
//Motor B forward mspeed full speed
digitalWrite(MotorL, LOW); //Establishes backward direction of Channel B
analogWrite(pwm_L, mspeed); //Spins the motor on Channel B at full speed
}// void goBackwad(int mspeed, int time_ms)

void turn_Right(int mspeed){
digitalWrite(BrakeR, LOW); //Disable Motor R Brake
digitalWrite(BrakeL, LOW); //Disable Motor L Brake
//Motor A backward mspeed full speed
digitalWrite(MotorR, LOW); //Establishes backward direction of Channel A
analogWrite(pwm_R, mspeed); //Spins the motor on Channel A at full speed
//Motor B forward mspeed full speed
digitalWrite(MotorL, HIGH); //Establishes forward direction of Channel B
analogWrite(pwm_L, mspeed); //Spins the motor on Channel B at full speed
}// void goBackwad(int mspeed, int time_ms)

void turn_Left(int mspeed){
digitalWrite(BrakeR, LOW); //Disable Motor R Brake
digitalWrite(BrakeL, LOW); //Disable Motor L Brake
//Motor A forward mspeed full speed
digitalWrite(MotorR, HIGH); //Establishes forward direction of Channel A
analogWrite(pwm_R, mspeed); //Spins the motor on Channel A at half speed
//Motor B backward mspeed full speed
digitalWrite(MotorL, LOW); //Establishes backward direction of Channel B
analogWrite(pwm_L, mspeed); //Spins the motor on Channel B at full speed
}// void goBackwad(int mspeed, int time_ms)

void goForward(int mspeed, int time_ms){
digitalWrite(BrakeR, LOW); //Disable Motor R Brake
digitalWrite(BrakeL, LOW); //Disable Motor L Brake
//Motor A forward mspeed full speed
digitalWrite(MotorR, HIGH); //Establishes forward direction of Channel A
analogWrite(pwm_R, mspeed); //Spins the motor on Channel A at half speed
//Motor B forward mspeed full speed
digitalWrite(MotorL, HIGH); //Establishes forward direction of Channel B
analogWrite(pwm_L, mspeed); //Spins the motor on Channel B at full speed
delay(time_ms);
}// void goForward(int mspeed, int time_ms)

void stopRobot(int delay_ms){
//analogWrite(pwm_out, 240);
digitalWrite(BrakeR, HIGH); //Engage the Brake for Channel A
digitalWrite(BrakeL, HIGH); //Engage the Brake for Channel B
delay(delay_ms);
}// void stopRobot(int delay_ms)

void stop_Robot(){
digitalWrite(BrakeR, HIGH); //Engage the Brake for Channel A
digitalWrite(BrakeL, HIGH); //Engage the Brake for Channel B
}// void stopRobot()

void SetPWM (const long pwm_num, byte pwm_channel){
if(pwm_channel==1){ // RIGHT
analogWrite(pwm_R, pwm_num);
pwmRvalue = pwm_num;
//Serial.write("pwm_RIGHT ");
//Serial.println(pwm_num);
}
else if(pwm_channel==2){ // LEFT
analogWrite(pwm_L, pwm_num);
pwmLvalue = pwm_num;
//Serial.write("pwm_LEFT ");
//Serial.println(pwm_num);
}
}// void SetPWM (const long pwm_num, byte pwm_channel)

The Uno only has one serial port, called Serial

Trying to use this code to connect the uno board to an app

But the code was not written for a Uno, which is why it does not compile.

The Uno doesn’t have a Serial1 hardware so it can’t use it.

Tested with Arduino Leonardo

So not a Uno then

Realised after I posted this, my mistake!

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn’t show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

You have two options to make this work for your Uno:

Use Serial instead of Serial1:
The downside to this is that Serial is also used to upload sketches to your Uno. So if you connect the Bluetooth module to the Serial pins (0 and 1) you will no longer be able to upload to the Uno without first disconnecting the module. It can also interfere with the use of Serial to output debug information to the Arduino IDE’s Serial Monitor over the USB cable (those commented out Serial.write() statements for example). Assuming you have a terminal connected to the other end, you could send debug info over Bluetooth but that won’t be helpful for troubleshooting Bluetooth problems.

Use software serial:
It’s possible to use any of the pins on your Uno as a serial port by using software serial. The Arduino IDE comes with a library for this named SoftwareSerial:
https://www.arduino.cc/en/Reference/SoftwareSerial