29 lines
374 B
Arduino
29 lines
374 B
Arduino
|
#include <Arduino.h>
|
||
|
#include <Wire.h>
|
||
|
|
||
|
#include "XGZP.h"
|
||
|
|
||
|
XGZP sensor;
|
||
|
|
||
|
float value = 1;
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(9600);
|
||
|
|
||
|
if(!sensor.begin()){
|
||
|
Serial.printf("Error initializing Sensor\n Locking up.");
|
||
|
while(1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
sensor.read(&value);
|
||
|
|
||
|
float corrected = 1.368 * value - 6.4;
|
||
|
|
||
|
Serial.print(corrected);
|
||
|
Serial.println(" PSI");
|
||
|
|
||
|
delay(250);
|
||
|
}
|