GAS TURBINE ECU help please! CLEVER CODERS ENTER!

Stimps:
I have so far a MEGA and a prototype on top (for my sensor and power supply components, etc)
and a TFTLCD shield on top of that.

:grin: :grin:

Ive come across a hurdle...Ive got my LCD code stripped down to just displaying a box, and ive got the AD595 hooked up to a free pin.
Now, I can load the lcd code no worries, and then load the thermocouple code instead ok
but when i merge the two i get compliation errors, namely, "printFloat" was not declared in this scope
code structure stresses me :frowning: lol

This thermocouple reading code was courtesy of an experimenter from Instructables.

// Define which analog input pin we have connected to the temperature sensor
#define TEMP_SENSOR_PIN 0

// if you tie the Arduino's vRef to the 3.3 volt supply, change this to 3.3
#define ANALOG_VOTLAGE_REFERENCE 5

void setup() {
Serial.begin(115200);
}

void loop() {
// prints the currrent temperature with 1 place after the decimal point
printFloat(getTemperature(), 1);
// print a carriage return
Serial.println();
// rest 100 milliseconds
delay(100);
}

float CtoF(float c) {
// optionally convert from Celsius to Farenheit if you are into that sorta thing
return c * 9.0 / 5.0 + 32.0;
}

float analogInToDegreesC(int inputValue) {
// divide by 1023, the maximum possible input value, that scales the input between 0 - 1
// then multiply by the reference voltage, which scales 0-1 to 0-vREF (default is 5V)
// lastly, multiply by 100 to scale it to 10s of millivolts or degrees
return inputValue / 1023.0 * ANALOG_VOTLAGE_REFERENCE * 100.0;
}
float getTemperature() {
// read the analog input, convert to degrees C, and covert to F
return CtoF(analogInToDegreesC(analogRead(TEMP_SENSOR_PIN)));
}

// ---- This last function, printFloat isn't necessary to understand unless you want to
// ---- feel free to ignore it for now, and treat it as a built-in utility,
// ---- it prints out floating point point values

// printFloat prints out the float 'value' rounded to 'places' places after the decimal point
void printFloat(float value, int places) {
// this is used to cast digits
int digit;
float tens = 0.1;
int tenscount = 0;
int i;
float tempfloat = value;

// make sure we round properly. this could use pow from <math.h>, but doesn't seem worth the import
// if this rounding step isn't here, the value 54.321 prints as 54.3209

// calculate rounding term d: 0.5/pow(10,places)
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;

// first get value tens to be the large power of ten less than value
// tenscount isn't necessary but it would be useful if you wanted to know after this how many chars the number will take

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('.');

// now write out each decimal place by shifting digits one by one into the ones place and writing the truncated value
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;
}