NodeMCU Projects: Difference between revisions
Content added Content deleted
Line 93: | Line 93: | ||
== DHT11 Temp Sensor == |
== DHT11 Temp Sensor == |
||
*Use DHT11 Module driectly, Do not use Sensor board with Pull Up resistor. |
|||
{{UC}} |
|||
*Testing Sensor: |
|||
<syntaxhighlight lang="python"> |
|||
>>> from machine import Pin |
|||
>>> from dht import DHT11 |
|||
>>> d = DHT11(Pin(14)) # Pin D5 |
|||
>>> d.measure() |
|||
>>> d.temperature() |
|||
28 |
|||
>>> d.humidity() |
|||
16 |
|||
</syntaxhighlight> |
|||
*Printing Temperature to I2C LCD |
|||
<syntaxhighlight lang="python"> |
|||
from machine import Pin |
|||
from dht import DHT11 |
|||
d = DHT11(Pin(14)) # Pin D5 |
|||
d.measure() |
|||
d.temperature() d.humidity() |
|||
</syntaxhighlight> |
|||
== Deep-sleep mode == |
== Deep-sleep mode == |