Help with code (error)

Just want to start off saying that this isn’t my code and I am new to Arduino. I have the error message; ‘gps_port’ was not declared in this scope. Can someone help? I’ve made that bit red in colour to help you find it and for that reason, I didn’t upload it as code, but as a long piece of text. Any help would be much appreciated.

static NMEAGPS gps; // This parses the GPS characters

const int temperaturePin = 5;

int i = 0;
int altitudeft;
int altitudecm;

byte gps_set_sucess = 0 ;

float voltage, degreesC, degreesF;

void sendUBX(uint8_t MSG, uint8_t len) {
for(int i=0; i<len; i++) {
gps_port.write(MSG
);*
_ Serial.print(MSG*, HEX);_
_
}_
gps_port.println();
_
}_
boolean getUBX_ACK(uint8_t MSG) {
uint8_t b;

* uint8_t ackByteID = 0;
uint8_t ackPacket[10];
_
unsigned long startTime = millis();*_
_ Serial.print(" * Reading ACK response: ");_

* // Construct the expected ACK packet *
* ackPacket[0] = 0xB5; // header*
* ackPacket[1] = 0x62; // header*
* ackPacket[2] = 0x05; // class*
* ackPacket[3] = 0x01; // id*
* ackPacket[4] = 0x02; // length*
* ackPacket[5] = 0x00;*
* ackPacket[6] = MSG[2]; // ACK class*
* ackPacket[7] = MSG[3]; // ACK id*
* ackPacket[8] = 0; // CK_A*
* ackPacket[9] = 0; // CK_B*

* // Calculate the checksums*
* for (uint8_t i=2; i<8; i++) {
_ ackPacket[8] = ackPacket[8] + ackPacket;
ackPacket[9] = ackPacket[9] + ackPacket[8];
}*_

* while (1) {*

* // Test for success*
* if (ackByteID > 9) {*
* // All packets in order!*
* Serial.println(" (SUCCESS!)");*
* return true;*
* }*

* // Timeout if no valid response in 3 seconds*
* if (millis() - startTime > 3000) {*
* Serial.println(" (FAILED!)");*
* return false;*
* }*

* // Make sure data is available to read*
* if (gps_port.available()) {
b = gps_port.read();*

* // Check that bytes arrive in sequence as per expected ACK packet*
* if (b == ackPacket[ackByteID]) {*
* ackByteID++;*
* Serial.print(b, HEX);*
* }*
* else {*
* ackByteID = 0; // Reset and look again, invalid order*
* }*

* }*
* }*
}
//----------------------------------------------------------------
static void printL( Print & outs, int32_t degE7 );
static void printL( Print & outs, int32_t degE7 )
{
* // Extract and print negative sign*
* if (degE7 < 0) {*
* degE7 = -degE7;*
* outs.print( ‘-’ );*
* }*
* // Whole degrees*
* int32_t deg = degE7 / 10000000L;
_ outs.print( deg );
outs.print( ‘.’ );
// Get fractional degrees*
degE7 -= deg10000000L;
// Print leading zeroes, if needed*
* int32_t factor = 1000000L;*
* while ((degE7 < factor) && (factor > 1L)){
outs.print( ‘0’ );
factor /= 10L;
}*_

* // Print fractional degrees*
* outs.print( degE7 );*
}
static void doSomeWork();
static void doSomeWork( const gps_fix & fix )
{
* // This is the best place to do your time-consuming work, right after*
* // the RMC sentence was received. If you do anything in “loop()”,*
* // you could cause GPS characters to be lost, and you will not*
* // get a good lat/lon.*
* // For this example, we just print the lat/lon. If you print too much,*
* // this routine will not get back to “loop()” in time to process*
* //the next set of GPS data.*
// test vs other option
* //float voltage, degreesC, degreesF;*
* //voltage = getVoltage(temperaturePin);*
_ //degreesC = (voltage - 0.5) * 100.0;
//degreesF = degreesC * (9.0/5.0) + 32.0;
* //Serial.println(degreesF);
if (i == 1) { // keeps a reading every 30 seconds. Change this to the time wanted between readings
//concern tha this takes time therefore could throw off repetition*
* // consistency*
// float voltage, degreesC, degreesF;
* voltage = getVoltage(temperaturePin);
degreesC = (voltage - 0.5) * 100.0;
degreesF = degreesC * (9.0/5.0) + 32.0;
if (degreesF > 300) {
}else {
// Serial.print("Degrees C "); //uncomment if you want celsius*
* // Serial.println(degreesC); //uncomment if you want celsius*
* Serial.print("Degrees F "); //comment if you do not want fahrenheit*
* Serial.println(degreesF); //comment if you do not want fahrenheit*
* }_
digitalWrite(LED_BUILTIN, HIGH);
_ if (fix.valid.time) {
// Set these values to the offset of your timezone from GMT*
* static const int32_t zone_hours = -7L; // PST*
* static const int32_t zone_minutes = 0L; // usually zero*
* static const NeoGPS::clock_t zone_offset =
zone_hours * NeoGPS::SECONDS_PER_HOUR +
zone_minutes * NeoGPS::SECONDS_PER_MINUTE;
NeoGPS::time_t localTime( fix.dateTime + zone_offset );*

* Serial << localTime;
}
if (fix.valid.location) {*_

* if ( fix.dateTime.seconds < 10 )*
* Serial.print( ‘0’ );*
* Serial.print( fix.dateTime.seconds );*
* Serial.print( ‘,’ );*

* // Serial.print( fix.latitude(), 6 ); // floating-point display*
* // Serial.print( fix.latitudeL() ); // integer display*
* printL( Serial, fix.latitudeL() ); // prints int like a float*
* Serial.print( ‘,’ );*
* // Serial.print( fix.longitude(), 6 ); // floating-point display*
* // Serial.print( fix.longitudeL() ); // integer display*
* printL( Serial, fix.longitudeL() ); // prints int like a float*
* Serial.print( ‘,’ );*
* if (fix.valid.satellites)*
* Serial.print( fix.satellites );*

* Serial.print( " , " );*
* Serial.print( fix.speed(), 6 );*
* Serial.print( F(" kn = ") );*
* Serial.print( fix.speed_mph(), 6 );
_ Serial.print( F(" mph") );
Serial.print( " " );
Serial.print(fix.heading());
Serial.print( F(" heading") );
Serial.print( " " );_
// Serial.print( gps.fix().altitude_cm());
altitudecm = gps.fix().altitude_cm();
_ altitudeft = altitudecm * 0.0328084;
Serial.print(altitudeft);*_

* } else {*
* // No valid location data yet!*
* Serial.print( ‘?’ );*
* }*
* Serial.println();*
* digitalWrite(LED_BUILTIN, LOW);
i = 0;
_}else{
i = i + 1;*_

* }// doSomeWork*
}
float getVoltage(int pin)
{
return (analogRead(pin) * 0.004882814);
}
//------------------------------------
static void GPSloop();
static void GPSloop()
{
* while (gps.available( gps_port ))
_ doSomeWork( gps.read() );
} // GPSloop*_

//--------------------------
void setup()
{
* Serial.begin(9600);*
* pinMode(LED_BUILTIN, OUTPUT);
_ // Start the UART for the GPS device*
gps_port.begin(9600);
Serial.println("Setting uBlox flight mode: ");
uint8_t setNav[] = {
* 0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00,
0x05, 0x00, 0xFA, 0x00, 0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xDC };_
while(!gps_set_sucess)
_ {_
sendUBX(setNav, sizeof(setNav)/sizeof(uint8_t));
gps_set_sucess=getUBX_ACK(setNav);
_ }_
gps_set_sucess=0;*

* while (!Serial);*

* Serial.print( F(“NMEAloc.INO: started\n”) );*
* Serial.print( F("fix object size = ") );*
* Serial.println( sizeof(gps.fix()) );*
* Serial.print( F("NMEAGPS object size = ") );*
* Serial.println( sizeof(gps) );*
* Serial.println( F(“Looking for GPS device on " USING_GPS_PORT) );
_ Serial.print(“High Altitude Weather Balloon Data Logger”);
Serial.println(” by Aaron Price");
Serial.println();
Serial.println(" Time Latitude Longitude SAT Wind Speed Wind Speed Altitude");
Serial.println(" (deg) (deg) knotts mph ft");
Serial.println("----------------------------------------------------------------------------------------------------------------");_
#ifdef NMEAGPS_NO_MERGING*

* Serial.println( F(“Only displaying data from xxRMC sentences.\n Other sentences may be parsed, but their data will not be displayed.”) );*
* #endif*
* Serial.flush();*

}
//--------------------------
void loop()
{
* GPSloop();*
* // If the GPS has been sending data, then the “fix” structure may have*
* // valid data. Remember, you must check the valid flags before you*
* // use any of the data inside “fix”. See “doSomeWork” for an example*
* // of checking whether any lat/lon data has been received yet.*
}

I have the error message; 'gps_port' was not declared in this scope.

What scope did you define it in?

Where is this declared? gps_port.
In order to use gps_port.write(MSG); you have to have a gps_port object.

I see no declaration for it.

PaulS:
What scope did you define it in?

I'm not sure, as I mentioned I am new to Arduino and haven't been able to figure out what went wrong as this isn't my code, I got it off someone online for a project I'm doing.
Where would I have to define it as an object?

You seem to be missing a serial port to read the GPS with. With an Arduino with only one hardware serial port (Uno, Mini, etc.) you would #include a software serial library and create an instance of a software serial object named gps_port. Look at the examples that come with the software serial library to see how to do it.

With an Arduino with multip!e harware serial ports you could use a #define to reference the hardware port with gps_port.

Savraj:
I'm not sure, as I mentioned I am new to Arduino and haven't been able to figure out what went wrong as this isn't my code, I got it off someone online for a project I'm doing.
Where would I have to define it as an object?

First, if this is not all the code, please post it all. IT does not seem to be all there. Next, did you make any modifications?

I will also mention that code is a mess and hard for us to read. Please use the code tags when you post all the code. Also have the ice indent it, CTL T I believe.

groundFungus:
You seem to be missing a serial port to read the GPS with. With an Arduino with only one hardware serial port (Uno, Mini, etc.) you would #include a software serial library and create an instance of a software serial object named gps_port. Look at the examples that come with the software serial library to see how to do it.

With an Arduino with multip!e hardware serial ports you could use a #define to reference the hardware port with gps_port.

Ive looked at the software serial library examples and still am lost in how I am meant to do this, please could you give me an idea of how to do this?

Thank you to everyone who tried to help me with this, I really appreciate it. It turns out gps_port was updated to gpsPort in an update of something. Bit of a weird one. I had to go to the person who wrote the code to figure this one out, but thank you everyone nonetheless!