44
Upload the program and you will see that the LCD will first display the brightness information of the
environment and whether it is raining, and then the LCD switches the screen to display the humidity and
temperature information of the current environment. Finally, the LCD will switch screens again to display
the current absolute and relative pressure information.
What will you see
1. Import BMP180, I2C, LCD and DHT library.
2. Create BMP180, DHT11 and LCD instances.
3. Declare the pin of modules, some variable and arrays.
4. Initialize the DHT, LCD and determine whether the modules is output or input.
5. Create the function to read luminance data and pressure data.
6. Read humidity, temperature and water information from sensor.
7. Print the luminance and whether it rains on LCD.
8. Print the humidity and temperature sensor on LCD.
9. Print the environment’s pressure information on LCD.
Code overview
Содержание Crowtail
Страница 48: ......