octopus temperature and humidity sensor DHT

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
marionabf
Posts: 1
Joined: Wed Aug 05, 2020 2:29 pm

octopus temperature and humidity sensor DHT

Post by marionabf » Wed Aug 05, 2020 9:11 pm

Hi,

I have the octopus temperature and humidity sensor for the micro:bit. I'm trying to program it with the MicroPython Mu editor, but when I flash the program into the micro:bit, the LED matrix shows: "line x import error no module named 'dht'".
How do modules work for micro:bit MicroPython? I thought that if I called it at the begginning of the program it would work...

The code:
from microbit import *
import dht
import machine
import time
sensor = dht.DHT11(machine.Pin(0))
while True:
sensor.measure()
print('Temperature = %.2f' % sensor.temperature())
print('Humidity = %.2f' % sensor.humidity())
time.sleep(3)

What can I do to make it work?

Thanks

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: octopus temperature and humidity sensor DHT

Post by shaoziyang » Thu Aug 06, 2020 2:11 am

dht is not build-in module in microbit. You may try BME280 or other I2C sensor.

Post Reply