NXC: Mindsensors PPS35 - ADC values to bar?
Posted: 13 Nov 2011, 19:28
hi,
are the Mindsensors PPS35 - ADC values already mbar?
or does anybody know how to convert them to bar / mbar?
or what exactly is
doing?
are the Mindsensors PPS35 - ADC values already mbar?
or does anybody know how to convert them to bar / mbar?
Code: Select all
/************************************************************************/
/* */
/* Program Name: PPS35-demo.nxc */
/* =========================== */
/* */
/* Copyright (c) 2008 by mindsensors.com */
/* Email: info (<at>) mindsensors (<dot>) com */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; version 3 of the License. */
/* Read the license at: http://www.gnu.org/licenses/gpl.txt */
/* */
/************************************************************************/
task main()
{
string msg;
int v;
SetSensorType(S1, SENSOR_TYPE_LIGHT);
while (true) {
msg = "Attach PPS35-Nx ";
TextOut(0, LCD_LINE1, msg, false);
msg = "Sensor to Port 1";
TextOut(0, LCD_LINE2, msg, false);
msg = "and change";
TextOut(0, LCD_LINE3, msg, false);
msg = "pressure.";
TextOut(0, LCD_LINE4, msg, false);
msg = "Pressure";
TextOut(0, LCD_LINE6, msg, false);
//***************************************************************
v = SensorValue(S1);
if (v<800) OnFwd(OUT_A,100); // air pressure pump: 800 mbar?
else Off(OUT_A);
//***************************************************************
msg = "value: ";
msg += NumToStr(v);
msg += " ";
TextOut(0, LCD_LINE7, msg, false);
Wait (200);
}
}
Code: Select all
ex_SensorMSPressure.nxc
This is an example of how to use the SensorMSPressure function.
int val = SensorMSPressure(S1);