This a basic code example to display the live temperature on an OLED connected to the Node MCU and also make it available through a simple endpoint
- GND to GND
- VCC to 3V3
- SCL to D1
- SDA to D2
- Out to D3
-
- to 3V3
-
- to GND
Web Endpoint is accessible through http://192.168.4.1/
Simply display the temperature and humidity
Show the temperature (raw)
Show the humidity (raw)
You can either use a dedicated NodeMCU for this and to make it available to other devices, you can use the endpoints at /humidity
and at /temperature
to get humidity and temperature respectively or you can simply embed the lines from the code you need in your project.
The main error is getting nan
in temperature as well as humidity. To troubleshoot this,
- Check if all wiring is done properly
- Restart it (NodeMCU)