コード例 #1
0
ファイル: bmp180.cpp プロジェクト: blinkingnoise/Sming
void BMPinit()
{
	// When we have connected, we reset the device to ensure a clean start.
	barometer.SoftReset();

	// Now we initialize the sensor and pull the calibration data
	barometer.Initialize();
	barometer.PrintCalibrationData();

	publishBMPTimer.initializeMs(TIMER * 3000, publishBMP).start();	// start publish BMP180 sensor data
}
コード例 #2
0
ファイル: application.cpp プロジェクト: flexiti/flexiti_sming
void Read_BMP180 ()
{


	if(!barometer.EnsureConnected())
		Serial.println("Could not connect to BMP180.");

	// When we have connected, we reset the device to ensure a clean start.
   //barometer.SoftReset();
   // Now we initialize the sensor and pull the calibration data.
    barometer.Initialize();
	barometer.PrintCalibrationData();

	Serial.print("Start reading");

	// Retrive the current pressure in Pascals.
	long currentPressure = barometer.GetPressure();

	// Print out the Pressure.
	Serial.print("Pressure: ");
	Serial.print(currentPressure);
	Serial.print(" Pa");

	// Retrive the current temperature in degrees celcius.
	float currentTemperature = barometer.GetTemperature();

	// Print out the Temperature
	Serial.print("\tTemperature: ");
	Serial.print(currentTemperature);
	Serial.write(176);
	Serial.print("C");

	Serial.println(); // Start a new line.

	cctemp=(int)(currentTemperature*10);
	ccpres=(int)(currentPressure/10);
}