-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhdc1080_demo.py
35 lines (31 loc) · 1.14 KB
/
hdc1080_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (c) Quectel Wireless Solution, Co., Ltd.All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
'''
@Author: Stephen.Gao
@Date: 2022-04-06
@Description: HDC1080 sensor demo
Copyright 2022 - 2022 quectel
'''
from machine import I2C
import utime as time
from usr.hdc1080 import Hdc1080
if __name__ == "__main__":
i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE)
hdc=Hdc1080(i2c_dev)
for i in range(10):
print("test %d begin." % (i + 1))
hum, tem = hdc.read()
print("current humidity is {0}%RH,current temperature is {1}°C".format(hum, tem))
print("test %d end." % (i + 1))
time.sleep(1)