arduino bt and LM34 temperature help with code

I have an issue i hope someone can help me with. i have an arduino bt and would like to use 3 LM 34 temperature sensors. I have found code for one of these sensors and works well. My problem is with code...i don't know any. I would like to add 2 more of these same sensors and have them print out like the current program that someone has written, i have posted the code below.
// Define which analog input pin we have connected to the temperature sensor

#define TEMP_SENSOR_PIN 0

#define ANALOG_VOTLAGE_REFERENCE 5

void setup() {

Serial.begin(115200);

}

void loop() {

// prints the currrent temperature with 2 place after the decimal point

printFloat(getTemperature(), 2);

// print a carriage return

Serial.println();

// rest 1000 milliseconds

delay(1000);

}

float CtoF(float c) {

return ((c -32.0) * 5.0 / 9.0 ) * 9.0 / 5.0 + 32.0 ;

}

float analogInToDegreesC(int inputValue) {

return inputValue / 1023.0 * ANALOG_VOTLAGE_REFERENCE * 100.0;

}

float getTemperature() {

return CtoF(analogInToDegreesC(analogRead(TEMP_SENSOR_PIN)));

}

void printFloat(float value, int places) {

int digit;

float tens = 0.1;

int tenscount = 0;

int i;

float tempfloat = value;

float d = 0.5;

if (value < 0)

d *= -1.0;

// divide by ten for each decimal place

for (i = 0; i < places; i++)

d/= 10.0;

// this small addition, combined with truncation will round our values properly

tempfloat += d;

if (value < 0)

tempfloat *= -1.0;

while ((tens * 10.0) <= tempfloat) {

tens *= 10.0;

tenscount += 1;

}

// write out the negative if needed

if (value < 0)

Serial.print('-');

if (tenscount == 0)

Serial.print(0, DEC);

for (i=0; i< tenscount; i++) {

digit = (int) (tempfloat/tens);

Serial.print(digit, DEC);

tempfloat = tempfloat - ((float)digit * tens);

tens /= 10.0;

}

// if no places after decimal, stop now and return

if (places <= 0)

return;

// otherwise, write the point and continue on

Serial.print('.');

for (i = 0; i < places; i++) {

tempfloat *= 10.0;

digit = (int) tempfloat;

Serial.print(digit,DEC);

// once written, subtract off that digit

tempfloat = tempfloat - (float) digit;

}

}

bhiggins6 years ago
//for three LM34s I would use a code like this. if your board pins are full consider using the dallas one wire set up

float temp3; // LM34s connected to analog pins 3,4,5
float temp4;
float temp5;
int tempPin3=4;
int tempPin4=4;
int tempPin5=5;

void setup() {

Serial.begin(9600);
}
void loop() {

temp3= analogRead(tempPin3);
temp3= (5.0*temp3*100.0)/1024.0;

temp4= analogRead(tempPin4);
temp4= (5.0*temp4*100.0)/1024.0;

temp5= analogRead(tempPin5);
temp5= (5.0*temp5*100.0)/1024.0; // temp output in Fahrenheit 

Serial.print("temp3=");
Serial.println(temp3);
//Temp3=Temp3*1.8+32;
//Serial.print("temp3 in C="); // do the same for pins 4,5 for temperatures in C
//Serial.println(temp3);

Serial.print("temp4=");
Serial.println(temp4);

Serial.print("temp5=");
Serial.println(temp5);

//delay(700); smaller delay, faster response, lower accuracy

}