Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimerOne issue in combination with BMP085 Adafruit driver #44

Open
rbrunni opened this issue Sep 14, 2020 · 0 comments
Open

TimerOne issue in combination with BMP085 Adafruit driver #44

rbrunni opened this issue Sep 14, 2020 · 0 comments

Comments

@rbrunni
Copy link

rbrunni commented Sep 14, 2020

Hello Paul,
I am using the TimerOne module in combination with the Adafruit BMP085 Sensor and driver. However when I run the call back function with the read out command for the sensor (bmp.readAltitude()), the program gets stuck. Any other command, e.g. a Serial.print command gets executed w/o any problems. I tried several different BMP085 drivers, all showing the same effect.
Unfortunately, I am not able to debug the issue with the native Arduino IDE.
I am using an Arduino Uno and the IDE shows Version 1.8.13. The little program file is attached below.
Any Idea?
Rbrunni


#include "TimerOne.h"
#include <Wire.h>
#include <Adafruit_BMP085.h>

Adafruit_BMP085 bmp;
// Define altitude variable
volatile float Altitude;

void setup() {
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
while (1) {}
}

Timer1.initialize(200000);
Timer1.attachInterrupt(ReadSensorAlt); // Read the altitude value every 200ms
}

void loop() {

Serial.print ("Altitude: ");
Serial.println (Altitude);  

}

void ReadSensorAlt(void)
{
// Read out of Sensor BMP085 does not work. Any other action works with the interrupt function
Altitude = bmp.readAltitude();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant