-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmindsensors-pressure-test1.c
47 lines (34 loc) · 1.19 KB
/
mindsensors-pressure-test1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma config(Sensor, S1, MSPPS, sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "drivers/mindsensors-pressure.h"
task main () {
long abspressure;
long gaugepressure;
// set the sensor to kilo Pascals
MSPPSsetUnit(MSPPS, MSPPS_UNIT_PSI);
wait1Msec(100);
MSPPSsetRefPressure(MSPPS);
wait1Msec(100);
nxtDisplayCenteredTextLine(0, "Mindsensors");
nxtDisplayCenteredBigTextLine(1, "PPS-v3");
nxtDisplayCenteredTextLine(3, "Test 1");
wait1Msec(2000);
// Read the current pressure and feed that to the ref pressure
// abspressure = MSPPSreadAbsPressure(MSPPS);
// MSPPSsetRefPressure(MSPPS, abspressure);
// you can also do this
MSPPSsetRefPressure(MSPPS);
while (true) {
eraseDisplay();
abspressure = MSPPSreadAbsPressure(MSPPS);
gaugepressure = MSPPSreadGaugePressure(MSPPS);
nxtDisplayTextLine(0,"MSPPS Test 1");
nxtDisplayTextLine(2, "Pressure (KPA):");
nxtDisplayTextLine(3, "Abs: %d", abspressure);
nxtDisplayTextLine(4, "Gauge: %d", gaugepressure);
wait1Msec(100);
}
}
/*
* $Id: mindsensors-pressure-test1.c 108 2012-09-16 09:06:13Z xander $
*/