Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: BMP280/main.cpp
- Revision:
- 1:94d75a291f23
- Parent:
- 0:c23b55e3ca7d
diff -r c23b55e3ca7d -r 94d75a291f23 BMP280/main.cpp
--- a/BMP280/main.cpp Mon Sep 06 09:15:22 2021 +0000
+++ b/BMP280/main.cpp Mon Sep 06 11:30:37 2021 +0000
@@ -8,7 +8,7 @@
Serial bluetooth(p9, p10); //tx, rx
CAN can(p30,p29); //CAN
I2C i2c(p9,p10); //SDA, SCL
-BMP280 bmp(i2c); //Default address = 0x76
+BMP280 bmp(i2c); //address par défaut= 0x77
int main()
@@ -25,21 +25,17 @@
//bmp.initialize();
- //declaration des variables d'affichage
+ //déclaration des variables d'affichage
float BMPTemp = 0;
float BMPPressure = 0;
//affichage de la variable de pression
while(1) {
- //BMPTemp = (bmp.getTemperature() - 32) / 1.8f;
BMPPressure = bmp.getPressure();
- //bluetooth.printf("Temp: %f, Pressure: %f\r\n",BMPTemp, BMPPressure);
-
bluetooth.printf("Pressure: %f\r\n",BMPPressure);
-
can.write(CANMessage(BMP_TMP_ID, (char*)&BMPTemp, sizeof(BMPTemp)/sizeof(char)));
- wait(0.1); //Need waits for some reason, without them the data doesnt always arrive in a neat order
+ wait(0.1); //Besoin de temps pour que la data arrive de façon nette
can.write(CANMessage(BMP_PRES_ID, (char*)&BMPPressure, sizeof(BMPPressure)/sizeof(char)));
wait(0.1);
}