Help with code for high altitude balloon

Hi all,

I am new to Arduino and am launching a high altitude balloon soon. We are adding a second temperature sensor (there is code for only one in the attached file). I need help on what I need to add/change/duplicate and am especially worried about screwing up the GPS. I have tried to do what I can but have hit a dead end. The file attached is without any changes made to it by me. The only thing I added to mine that I'm sure will work is const int temperaturePin2 = 6; .

Help would be much appreciated,

Savraj

HighAltitudeBalloon3.2.ino (10.2 KB)

Please post the program that represents your best attempt at extending the code in your next Reply. It will be easier to help if we can see how you are thinking of going about the problem.

Also please post links to the datasheets for the temperature sensors.

...R

Here's the datasheet for the temperature sensor: https://www.arduino.cc/en/uploads/Main/TemperatureSensor.pdf

The only thing I have actually put in is const int temperaturePin2 = 6; as I wasn't sure what else to do but I've attached that file anyway.

Thanks

HighAltitudeBalloon3.2_v2.ino (10.2 KB)

You seem to have this code for getting the first temperature

 voltage = getVoltage(temperaturePin);
  degreesC = (voltage - 0.5) * 100.0;
  degreesF = degreesC * (9.0/5.0) + 32.0;

I don't see any problem duplicating it (with different variable names) for a second sensor.

Separately I don't know why you have temperature code and GPS code in the same function. Using short single purpose functions with meaningful names makes code much easier to develop and debug

And there seems to be a strange sequence of top-level functions that do nothing useful

loop() only calls GPSloop() which only calls doSomeWork()

Why not just have the code from doSomeWork() in loop() ?

...R
Planning and Implementing a Program

If you want this balloon launch to be successful and do something useful, I recommend bringing someone on to your team who already understands Arduino.

That person should make sure that the code will work as expected, before the launch.