Our code supports many sensors, so you will have to specify which sensors you have added to your NodeMCU. This is done in a header file called Device.h
Go to lib -> Device and locate Device.h.sample
Right-click on it, choose Duplicate and change the name of the new file to Device.h
Open the file you just created (Device.h) and now you will have to edit it in order to set up sensors and devices that you will attach using instructions in Hardware Setup section.
In order to do this, you have to uncomment lines that include header files and constructors for sensors that you will use. For example, if you're using BME280 for temperature, humidity and pressure measurement, you will need to uncomment the next two lines:
#include "BME_280.h" (Header file) and
BME_280 bme(D3, D4); (Constructor)
In order to uncomment a specific line, you just need to remove two dashes (//) which are placed at the beginning of that line.
Make sure that you've connected it properly
Please make sure that the pins that you put in the constructor (D3 and D4 for BME280 for example) are the same pins like the ones that you connected sensors and devices to on the NodeMCU board. If you have not connected hardware yet, please return to this section after you do it.
Also, when editing Device.h, please make sure that you've configured all sensors and devices that you are using in your hardware setup in order to make them functional.
There is no need to declare sensors and devices that you will not use in your hardware setup. If you do this, you will produce data points in your schema which will be filled with incorrect data.
Save the changes that you've made in Device.h.
When you are done it should look like shown in the picture.
Configure your own setup
Please have in mind that picture shown above contains Device.h for setup that uses BME280 & PMS1003 sensors and WS2812 LED Ring connected in a way that is configured in this file. Please configure Device.h corresponding to your hardware setup.
Updated over 1 year ago