Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. int rawValue; // A/D readings
  2. int offset = 67; // zero pressure adjust
  3. int fullScale = 922; // max pressure (span) adjust
  4. float pressure; // final pressure
  5.  
  6. void setup() {
  7. Serial.begin(9600);
  8. }
  9.  
  10. void loop() {
  11. rawValue = analogRead(A0);
  12. Serial.print("Raw A/D is ");
  13. Serial.print(rawValue);
  14. pressure = (rawValue - offset) * 1.2 / (fullScale - offset); // pressure conversion to maps
  15. pressure = (pressure * 145.038); // mpa to psi
  16. Serial.print(" The pressure is ");
  17. Serial.print(pressure, 3); // three decimal places
  18. Serial.println(" PSI");
  19. delay(500);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement