Need help on MPL115A2 (Barometric) sensor from Adafruit [solved]

I’m new with arduino and I try to program a MPL115A2 (Barometric / Temperature) sensor from Adafruit to Arduino board.

I install the Adafruit_MPL115A2.h and Adafruit_MPL115A2.cpp in my lybrary folder and get this .ino program from Adafruit site.

#include <Adafruit_MPL115A2.h>

#include <Wire.h>

Adafruit_MPL115A2 mpl115a2;
void setup(void)
{
Serial.begin(9600);
Serial.println(“Hello!”);
Serial.println(“Getting barometric pressure …”);
mpl115a2.begin();
}

void loop(void)
{
float pressureKPA = 0, temperatureC = 0;
pressureKPA = mpl115a2.getPressure();
Serial.print(“Pressure (kPa): “);
Serial.print(pressureKPA, 4);
Serial.println(” kPa”);
temperatureC = mpl115a2.getTemperature();
Serial.print(“Temp (*C): “);
Serial.print(temperatureC, 1);
Serial.println(” *C”);
delay(1000);
}

Two other lybrary inside the Adafruit_MPL115A2.cpp are required : Wprogram and Arduino.
I was only able to find the .h code but not able to found the .cpp code for this two library ???

I’m not able to compile the above program - I got those error :

In file included from PT2.ino:1:
C:\Users\Alain\Documents\Arduino\libraries\Adafruit_MPL115A2/Adafruit_MPL115A2.h:1:612: error: missing binary operator before token “#”
C:\Users\Alain\Documents\Arduino\libraries\Adafruit_MPL115A2/Adafruit_MPL115A2.h:1:1: error: unterminated #if
In file included from PT2.ino:3:
C:\Users\Alain\Documents\Arduino\libraries\Adafruit_MPL115A2/Adafruit_MPL115A2.h:1:612: error: missing binary operator before token “#”
C:\Users\Alain\Documents\Arduino\libraries\Adafruit_MPL115A2/Adafruit_MPL115A2.h:1:1: error: unterminated #if
PT2:8: error: ‘Adafruit_MPL115A2’ does not name a type
PT2.ino: In function ‘void setup()’:
PT2:14: error: ‘mpl115a2’ was not declared in this scope
PT2.ino: In function ‘void loop()’:
PT2:20: error: ‘mpl115a2’ was not declared in this scope

Can someone help…THANk…

Alain

It compiled OK for me.

Download the library from: GitHub - adafruit/Adafruit_MPL115A2: Driver for the Adafruit MPL115A2 barometric pressure sensor breakout

When downloaded rename the resulting folder to "Adafruit_MPL115A2" and copy that to your libraries folder.

Restart the IDE. Then it should compile OK.

Just to wrap up this thread, I got a PM from the OP saying that his error was to copy and paste from the screen on the website, rather than download the code as a .zip file.

Once downloaded, it worked.

@Prof: It helps others, who may be searching for your problem, to state what the solution is on the forum thread. Thanks!