1

I'm trying to connect two BMP180s to an arduino uno by using a multiplexer.

Here is the code that a guy has written before: I imported SFE_BMP180 library but didn't do anything with the "typedef.h" thing.

I'm getting "Data does not name a type" error at the line 9. How can I solve this problem?

     #include <SFE_BMP180.h>
    #include <Wire.h>
    #include "typedef.h"

    #define SELECT_PIN 9
    #define ALTITUDE 510.0

#define P1_ACTIVE digitalWrite(SELECT_PIN,HIGH); //delay(10);
#define P2_ACTIVE digitalWrite(SELECT_PIN,LOW);  //delay(10);

SFE_BMP180 bmp1,bmp2;
boolean readSensors(Data *data1, Data *data2);

Data newData(char id)
{
  Data d ; 
  d._id = id ;
  return d ;
}
void setup()
{
    boolean failed = false ;
    pinMode(SELECT_PIN, OUTPUT);

    Serial.begin(9600);

    P1_ACTIVE

    if(bmp1.begin()){
        Serial.println("BMP #1 init success.");
    }
    else 
          failed = true ;


    P2_ACTIVE
    if(bmp2.begin()){
          Serial.println("BMP #2 init success.");
    }
    else 
        failed = true ;

    if(failed){
        Serial.println("Error in BMP180 init.");
        while (1);
    }
}

void loop()
{
  Data d1 = newData('1');
  Data d2 = newData('2');

  boolean read = readSensors(&d1,&d2);


  if(read){
          /* print the value to serial terminal */
...
1

You can try my BMP080/BMP180 Arduino library My library doesn't require use of floats of math library, making your sketch very small and fast.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.