Arduino mega instruction for arduino uno?

I started working with Cayenne for an IoT project and at thebeginning you’re supposed to choose a device. I chose Arduino Uno with ESP8266 wifi module, which opened up a sketch that says to use Serial1 pins that are available in the Arduino MEGA board. It is futher written that i can use the software serial pins and it is written that they are unstable however I can’t even find those. Really need help please!

this is the code to use with arduino uno

/*
This sketch connects to the Cayenne server using an ESP8266 WiFi module as a shield connected via a hardware serial to an Arduino.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Install the ESP8266SerialLibrary.zip library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library) from the Cayenne extras/libraries
   folder (e.g. My Documents\Arduino\libraries\CayenneMQTT\extras\libraries) to compile this example.
2. Connect the ESP8266 as a shield to your Arduino. This example uses the Serial hardware serial pins available on the UNO. 
3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
4. Set the network name and password.
5. Compile and upload the sketch.
6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.

NOTE: This code requires ESP8266 firmware version 1.0.0 (AT v0.22) or later.
*/

//#define CAYENNE_DEBUG       // Uncomment to show debug messages
//#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>

// WiFi network info.
char ssid[] = "";
char wifiPassword[] = "";


char username[] = "";
char password[] = "";
char clientID[] = "";

// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
#define EspSerial Serial

ESP8266 wifi(&EspSerial);

void setup()
{
  delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(10);
    Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}

void loop()
{
  Cayenne.loop();
}

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
  // Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
  Cayenne.virtualWrite(0, millis());
  // Some examples of other functions you can use to send data.
  //Cayenne.celsiusWrite(1, 22.0);
  //Cayenne.luxWrite(2, 700);
  //Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
  CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
  //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}

Thank you so much!

Do i just continue with the instructions of the previous sketch or?

everything is same except you need to connect the esp to serial pins of arduino.

I have connected but I am not sure where to define them in the code. Sorry i’m just really new to this.

it is already defined in the code.

I’m unable to upload the code.
This is the error I am getting;
Arduino: 1.9.0-beta (Windows 10), Board: “Arduino/Genuino Uno”

Sketch uses 20730 bytes (64%) of program storage space. Maximum is 32256 bytes.
Global variables use 1140 bytes (55%) of dynamic memory, leaving 908 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

you have to disconnect the esp from uno while uploading the code and then connect it once done.

And then upload the code again?

no. once uploaded you can connect the esp.

its still saying waiting for board to connect

what is the serial monitor output?

on the Cayenne website to create the dashboard, it;s saying that it is waiting for the board to connect. The code has uploaded, and I have connected the ESP, but the dashboard is taking long :confused:

share the output here.

Sketch uses 20730 bytes (64%) of program storage space. Maximum is 32256 bytes.
Global variables use 1140 bytes (55%) of dynamic memory, leaving 908 bytes for local variables. Maximum is 2048 bytes.

its blank

set the baud rate 115200

13:52:45.966 → AT
13:52:48.509 → AT
13:52:51.006 → AT
13:52:53.518 → AT
13:52:56.010 → AT
13:52:58.514 → AT
13:53:01.058 → AT
13:53:03.560 → AT
13:53:06.067 → AT
13:53:07.715 → AT
13:53:08.016 → AT
13:53:08.049 → AT
13:53:08.617 → AT
13:53:09.526 → AT
13:53:12.091 → AT
13:53:14.586 → AT
13:53:17.115 → AT
13:53:19.607 → AT
13:53:22.129 → AT
13:53:24.646 → AT
this is the output from my serial monitor