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.
BMP280/main.cpp
- Committer:
- louatayehh
- Date:
- 2021-09-06
- Revision:
- 1:94d75a291f23
- Parent:
- 0:c23b55e3ca7d
File content as of revision 1:94d75a291f23:
#include "mbed.h" #include "BMP280.h" #define BMP_TMP_ID 0x8 #define BMP_PRES_ID 0x9 //declarations Serial bluetooth(p9, p10); //tx, rx CAN can(p30,p29); //CAN I2C i2c(p9,p10); //SDA, SCL BMP280 bmp(i2c); //address par défaut= 0x77 int main() { //Configuration Serial bluetooth.baud(56000); //bluetooth.format(8, SerialBase::None, 1); //bluetooth.set_flow_control(SerialBase::Disabled, NC, NC); //Configuration bus CAN can.frequency(125000); //vitesse du bus CAN 125kHz can.reset(); //bmp.initialize(); //déclaration des variables d'affichage float BMPTemp = 0; float BMPPressure = 0; //affichage de la variable de pression while(1) { BMPPressure = bmp.getPressure(); bluetooth.printf("Pressure: %f\r\n",BMPPressure); can.write(CANMessage(BMP_TMP_ID, (char*)&BMPTemp, sizeof(BMPTemp)/sizeof(char))); 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); } }