1

I am using BMP 280 for an altimeter to measure the altitude. Once all connected and uploaded the BMP280test code from Adafruit, the serial monitor says busy. But still, when I switch the port in tools, nothing shows on the serial monitor. How do I get the monitor to start displaying data?

Thanks

Code:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)

Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(9600);
  Serial.println(F("BMP280 test"));

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

  /* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
}

void loop() {
    Serial.print(F("Temperature = "));
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");

    Serial.print(F("Pressure = "));
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");

    Serial.print(F("Approx altitude = "));
    Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */
    Serial.println(" m");

    Serial.println();
    delay(2000);
}
4
  • 1
    Start simple. Assuming you are using an Arduino Uno and running on a Win10 machine. Since you are having problems with talking to the Arduino over the serial port forget about the pressure sensor and this pressure sensor application. Start with a simpler Arduino program which only talks over the serial port. Try this or this. – st2000 Sep 5 '20 at 18:44
  • "the serial monitor says busy" - what does that mean? And what do you mean with switching ports? – chrisl Sep 5 '20 at 21:25
  • @chrisl, being sarcastic? It's pretty clear he is talking about com ports. "The serial monitor says" is talking about the serial monitor in Arduino ide (ctrl + shift + m). He obviously has multiple com ports available on his PC and doesn't know what com port represents the usb-serial on his uno. Sounds to me either something else is holding up the com port, or maybe he doesn't have the right drivers loaded: maybe a clone with the ch340 usb-serial chip? – Tim_Stewart Oct 6 '20 at 17:21
  • @TimStewart Nope, not being sarcastic. While the topic is clear, I wanted a detailed description of what the OP did exactly. Of course you can write an answer to this question. Me finding the question not clear enough is just a subjective view. – chrisl Oct 6 '20 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.