Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int rawValue; // A/D readings
- int offset = 67; // zero pressure adjust
- int fullScale = 922; // max pressure (span) adjust
- float pressure; // final pressure
- void setup() {
- Serial.begin(9600);
- }
- void loop() {
- rawValue = analogRead(A0);
- Serial.print("Raw A/D is ");
- Serial.print(rawValue);
- pressure = (rawValue - offset) * 1.2 / (fullScale - offset); // pressure conversion to maps
- pressure = (pressure * 145.038); // mpa to psi
- Serial.print(" The pressure is ");
- Serial.print(pressure, 3); // three decimal places
- Serial.println(" PSI");
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement