Snippet Tag: pressure sensor ino code

Arduino pressure sensor code

#include <Wire.h> #include <AMS5915.h> AMS5915 ams; const float AMS5915_0005_D_P_MIN = 0.0; // minimum pressure, millibar const float AMS5915_0005_D_P_MAX = 5.0; // maximum pressure, millibar void setup(void) { Serial.begin(9600); // The address can be changed making the option of connecting multiple devices ams.getAddr_AMS5915(AMS5915_DEFAULT_ADDRESS); // 0x28 ams.begin(); delay(500); } void loop(void) { byte error; int8_t address; address = ams.ams_i2cAddress; // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { ams.Measure_PressureAndTemperature(AMS5915_0005_D_P_MIN, AMS5915_0005_D_P_MAX); float cTemp, fTemp, pressure, kPa, hg; Serial.println("Getting Readings from AMS5915_0005-D");

Read More »