标题: STM32_BMP280资料+源代码 [打印本页]

作者: 569099575    时间: 2019-4-12 15:33
标题: STM32_BMP280资料+源代码
STM32_BMP280

单片机源程序如下:
  1. #include "sys.h"
  2. #include "delay.h"
  3. #include "usart.h"
  4. #include "led.h"
  5. #include "myiic.h"
  6. #include "bme280.h"

  7. int main(void)
  8. {
  9.         float bmp280_temp;
  10.         float bmp280_press;
  11.         float bmp280_humi;
  12.         float high;
  13.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);                            //设置中断优先级分组2
  14.         uart_init(9600);                                                           //初始化USART
  15.         LED_Init();                                                                //初始化LED
  16.     IIC_Init();       
  17.         delay_init();
  18.         bme280Init();
  19.     while(1)
  20.     {
  21.         bme280GetData(&bmp280_press,&bmp280_temp,&bmp280_humi,&high);
  22.                 delay_ms(1500);
  23.                 LED0=!LED0;
  24.                 printf("bmp280_press:%f\r\n",bmp280_press);
  25.                 delay_ms(100);
  26.                 printf("bmp280_temp :%f\r\n",bmp280_temp);
  27.                 delay_ms(100);
  28.                 printf("bmp280_humidity :%f\r\n",bmp280_humi);
  29.                 delay_ms(100);
  30.                 printf("bmp280_high :%f\r\n\r\n",high);
  31.         }
  32. }
复制代码

所有资料51hei提供下载:
BME280_STM32.zip (2.88 MB, 下载次数: 488)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1