here is the wiring (some how my images from my google drive didn't show up, i attach the image in the attachment)
If you read the "hot to use this forum" you knew that links to google drive are a no-go. Attaching the image is the way to do it.
You didn't understand me:
when i test the altimeter from the examples
it works with the same wiring
I want to see the code that let the altimeter work with exactly the same hardware setup. As there are several examples and people tend to modify example to let them work with their setup, I want to see all the code mentioned in the posts. So post that example code exactly as it worked for you.
pylon:
If you read the "hot to use this forum" you knew that links to google drive are a no-go. Attaching the image is the way to do it.
i apologize didn't read all oh the tutorial in those thread.
You didn't understand me:
I want to see the code that let the altimeter work with exactly the same hardware setup. As there are several examples and people tend to modify example to let them work with their setup, I want to see all the code mentioned in the posts. So post that example code exactly as it worked for you.
i am using examples from sparkfun
/*
MPL3115A2 Barometric Pressure Sensor Library Example Code
By: Nathan Seidle
SparkFun Electronics
Date: September 24th, 2013
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
Uses the MPL3115A2 library to display the current altitude and temperature
Hardware Connections (Breakoutboard to Arduino):
-VCC = 3.3V
-SDA = A4 (use inline 10k resistor if your board is 5V)
-SCL = A5 (use inline 10k resistor if your board is 5V)
-INT pins can be left unconnected for this demo
During testing, GPS with 9 satellites reported 5393ft, sensor reported 5360ft (delta of 33ft). Very close!
During testing, GPS with 8 satellites reported 1031ft, sensor reported 1021ft (delta of 10ft).
Available functions:
.begin() Gets sensor on the I2C bus.
.readAltitude() Returns float with meters above sealevel. Ex: 1638.94
.readAltitudeFt() Returns float with feet above sealevel. Ex: 5376.68
.readPressure() Returns float with barometric pressure in Pa. Ex: 83351.25
.readTemp() Returns float with current temperature in Celsius. Ex: 23.37
.readTempF() Returns float with current temperature in Fahrenheit. Ex: 73.96
.setModeBarometer() Puts the sensor into Pascal measurement mode.
.setModeAltimeter() Puts the sensor into altimetery mode.
.setModeStandy() Puts the sensor into Standby mode. Required when changing CTRL1 register.
.setModeActive() Start taking measurements!
.setOversampleRate(byte) Sets the # of samples from 1 to 128. See datasheet.
.enableEventFlags() Sets the fundamental event flags. Required during setup.
*/
#include <Wire.h>
#include "SparkFunMPL3115A2.h"
//Create an instance of the object
MPL3115A2 myPressure;
void setup()
{
Wire.begin(); // Join i2c bus
Serial.begin(9600); // Start serial for output
myPressure.begin(); // Get sensor online
//Configure the sensor
myPressure.setModeAltimeter(); // Measure altitude above sea level in meters
//myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
myPressure.enableEventFlags(); // Enable all three pressure and temp event flags
}
void loop()
{
//float altitude = myPressure.readAltitude();
//Serial.print("Altitude(m):");
//Serial.print(altitude, 2);
float altitude = myPressure.readAltitudeFt();
Serial.print(" Altitude(ft):");
Serial.print(altitude, 2);
//float pressure = myPressure.readPressure();
//Serial.print("Pressure(Pa):");
//Serial.print(pressure, 2);
//float temperature = myPressure.readTemp();
//Serial.print(" Temp(c):");
//Serial.print(temperature, 2);
float temperature = myPressure.readTempF();
Serial.print(" Temp(f):");
Serial.print(temperature, 2);
Serial.println();
}
If you compare the two codes the Wire.begin() is missing in your code and there is also no tier.enableEventFlags() (although I don't think this is actually needed but recommended in the datasheet).
In current versions of the library the tier.begin() calls Wire.begin() so that cannot be the problem too.
To be sure, try adding the enableEventFlags() call.
So are you completely sure you're trying both sketches with exactly the same hardware setup (not one device or wire removed for one sketch but there for the other)?
pylon:
If you compare the two codes the Wire.begin() is missing in your code and there is also no tier.enableEventFlags() (although I don't think this is actually needed but recommended in the datasheet).
In current versions of the library the tier.begin() calls Wire.begin() so that cannot be the problem too.
To be sure, try adding the enableEventFlags() call.
I'll try after my thesis defence this friday.
thank you for the advice.
So are you completely sure you're trying both sketches with exactly the same hardware setup (not one device or wire removed for one sketch but there for the other)?