Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mcauser committed Jun 24, 2017
1 parent 13b7eaa commit 6b7a323
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,36 @@ A MicroPython library for interfacing with an Aosong DHT12 temperature and humid

This library focuses on using the I2C interface. The sensor also supports a 1-wire interface, available when pin 4 is connected to GND.

#### Pinout
![demo](docs/DHT12.jpg)

#### Examples

Basic measurement

```
+---------+
|xxxxxxxxx|
|xxxxxxxxx|
+---------+
| | | |
1 2 3 4
import dht12
from machine import I2C, Pin
i2c = I2C(scl=Pin(5), sda=Pin(4))
sensor = dht12.DHT12(i2c)
sensor.measure()
print(sensor.temperature())
print(sensor.humidity())
```

1=VDD, 2=SDA, 3=GND, 4=SCL
Continuous measurement

For full documentation see http://micropython-dht12.rtfd.io/.
```
import time
import dht12
from machine import I2C, Pin
i2c = I2C(scl=Pin(5), sda=Pin(4))
sensor = dht12.DHT12(i2c)
![demo](docs/DHT12.jpg)
while True:
sensor.measure()
print(sensor.temperature())
print(sensor.humidity())
time.sleep_ms(4000)
```

For full documentation see http://micropython-dht12.rtfd.io/.
Binary file modified docs/DHT12.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6b7a323

Please sign in to comment.