OK, I am 73 but I should be able to get this! All the examples I can find do not run even though I program them exactly as shown so I'm asking for assistance on my specific try. I have an Adafruit Feather M0 Bluefruit LE with a 3 wire pressure transducer connected to Pin#A0. I am using the measured pressure to calculate the height of water in a tank. My code is:
/* Rev 1.3 */
float zeroTank = 6.39; //560 = 4.5" 720=6.3"
float tankHeight = 5.1; //total height of tank
float totalGal= 39.0 ; //total capacity of tank
float maxInch = 8.0; //calibration point
int calMin = 111; //0 pressure at sensor, .34V=106 (5V system was 128)
int calMax = 837; //850=8.0" (was 895 for 5V)
float tankZero = 3.0; //# inches tank bottom is from sensor
float heightinTank;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 3.3V):
float voltage = sensorValue * (3.3 / 1023.0);
float absHeight = ((sensorValue-calMin) maxInch )/(calMax-calMin);
heightinTank = absHeight-zeroTank;
if (heightinTank <0) { heightinTank = 0;
}
float gallons = heightinTanktotalGal/tankHeight;
// print out the value you read:
Serial.println(sensorValue);
/Serial.print(" ");
Serial.print(voltage);
Serial.print(" ");
Serial.print("V ");
Serial.print(absHeight);
Serial.print(" in ");
Serial.print(heightinTank);
Serial.print(" in ");
Serial.print(gallons);
Serial.println(" gal ");/
delay(2000);
}
My App Invertor Blocks are:
These blocks allow me to connect to the board but just shows 0 as the output..
Thanks for any help!
Doug