![Whadda WPSE342 Скачать руководство пользователя страница 10](http://html1.mh-extra.com/html/whadda/wpse342/wpse342_user-manual_967083010.webp)
10
Now upload the code to your Arduino® Uno board. Make sure to select the correct
board
and
COM port
. Open the serial monitor with baud rate
115200
, normally the basic sensor
float data will be presented in the serial monitor. If everything is working properly, you will
see a similar message on the serial monitor.
Code Explanation
Libraries
The basic example code starts by including the required libraries to interface with the
onboard sensors of the air quality sensor combo board. These are the standard Arduino®
Wire
library using the I²C interface, the
Sparkfun BME280
and
Sparkfun CCS811
library.
#include
<Wire.h>
#include
"SparkFunBME280.h"
#include
"SparkFunCCS811.h"
I²C
We are using the I²C interface protocol by default. We need to create 2 objects: a
BME280
object called
myBME280
, and a
CCS811
object called
myCCS811
.
BME280 myBME280
;
CCS811 myCCS811
(
CCS811_ADDR
)
;
We initialize the CCS811 sensor with address
0x5B
(standard).
#define
CCS811_ADDR 0x5B