cansat code help

hello,
we are a team which are in the UK Cansat competition we have got four senors that we need to get information of the temperature, air pressure, which is the primary mission and a gyro/accelerometer which is our secondary mission.

we have got the example code for the senors and they all work on there own bit when we try to combine them into on sketch then we get one error that we can not find out what is the cause/problem but this code is only for the two temperature and air pressure sensors not the gyro/accelerometer. the error that we are getting is (all_code_combined_:32: error: expected constructor, destructor, or type conversion before '=' token)

the sensors are:

  • Pressure sensor (MPX4115)
  • Temperature sensor (LM35Dz)
  • Temperature sensor (NTCLE100E3103JB)
  • gyro/accelerometer (MPU 6050)

Here is the code for the three sensors apart from the MPU 6050 as it stands

int val;
int tempPin = A1;

void setup()
{
Serial.begin(9600);
Serial.println("Thermistor temperature measurement:");
Serial.println("\n Vo Rt T (C)");
}
void loop()
{
float pressure = readPressure(A0);
float millibars = pressure/100;
Serial.println();
Serial.print("Pressure = ");
Serial.print(pressure);
Serial.println(" pascals");
Serial.print("Pressure = ");
Serial.print(millibars);
Serial.println(" millibars");
delay(1000);
}

float readPressure(int pin){
int pressureValue = analogRead(pin);
float pressure=((pressureValue/1024.0)+0.095)/0.000009;
return pressure;
}

val = analogRead(tempPin){
float mv = ( val/1024.0)5000;
float cel = mv/10;
float farh = (cel
9)/5 + 32;

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);

float temp = readTemp(A2);
delay(1000);
}

/*

  • Reads the temperature of a thermister, at the given pin.
  • Return the temperature as Kelvin
    /
    float readTemp(int pin){
    int Vo; // Integer value of voltage reading
    float R = 9830.0; // Fixed resistance in the voltage divider
    /
  • Steinhart-Hart Equation coefficients.
  • Calculated from datasheet reference temps/resistances.
    */
    float c1 = 1.3084634E-03;
    float c2 = 2.344772E-04;
    float c3 = 1.04177209450756E-07;
    float logRt,Rt,T;

Vo = 1023 - analogRead(pin); // Read thermister voltage
Rt = R*( 1023.0 / (float)Vo - 1.0 ); // Calculate thermister resistance
logRt = log(Rt);

// Apply Steinhart-Hart equation.
T = ( 1.0 / (c1 + c2logRt + c3logRtlogRtlogRt ) );

Serial.print(" ");
Serial.print(Vo);
Serial.print(" ");
Serial.print(Rt);
Serial.print(" ");
Serial.println(kelvinToCelcius(T));

return T;
}

float kelvinToCelcius(float temp){
return temp - 273.15;
}

thanks for the answers/help.

Please use code tags, not quote tags, in future.

Please be consistent in your coding style. The opening brace '{' is either on a line of its own, or it isn't. Don't mix.

 val = analogRead(tempPin){

appears to be outside any function / procedure?

OK thanks new to the form,

will try to fix it but dont know were it would go

Firstly, move the line

float temp = readTemp(A2);

to the loop() function.

Then 'lose' the secton

 val = analogRead(tempPin){
    float mv = ( val/1024.0)*5000; 
    float cel = mv/10;
    float farh = (cel*9)/5 + 32;

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);


float temp = readTemp(A2);
    delay(1000);
}

and see how that gets on. I've not studied your code so it may contain further errors.

thank no error messages now thank god but still got a bit of cod to do ill write some code and see were that takes me lol