code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for CHT8305
Author: HaaS
Date: 2021/09/14
"""
from micropython import const
from utime import sleep_ms
from driver import I2C
CHT8305_REG_TEMP = 0x00
CHT8305_REG_HUMI = 0x01
# The register address in CHT8305 controller.
c... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/floriculture/haaseduk1/code/cht8305.py | Python | apache-2.0 | 4,277 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
"""
from driver import I2C
import kv
class HAASEDUK1(object):
def __init__(self):
self.i2cDev = None
# 获取版本号
# 返回值为1,代表k1c
# 返回值为0,代表k1
def getHWID(self):
hwId = -1
result = kv.geti("HAASEDU_NAME")
if (result... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/floriculture/haaseduk1/code/haaseduk1.py | Python | apache-2.0 | 1,984 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 温湿度上云
@Author : ethan.lcz
@version : 1.0
'''
from aliyunIoT import Device # aliyunIoT组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi功能所在库
import utime # 延时API所在组件
from driver import I2C #... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/floriculture/haaseduk1/code/main.py | Python | apache-2.0 | 7,502 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's drive for SI7006
Author: HaaS
Date: 2021/09/09
"""
from driver import I2C
from utime import sleep_ms
# The commands provided by SI7006
Si7006_MEAS_REL_HUMIDITY_MASTER_MODE = 0xE5
Si7006_MEAS_REL_HUMIDITY_NO_MASTER_MODE = 0xF5
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/floriculture/haaseduk1/code/si7006.py | Python | apache-2.0 | 5,698 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 温湿度上云
@Author : ethan.lcz
@version : 1.0
'''
from ulinksdk.aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
from driver import I2C... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/floriculture/stm32/code/main.py | Python | apache-2.0 | 7,339 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for CHT8305
Author: HaaS
Date: 2021/09/14
"""
from micropython import const
import utime
from driver import I2C
'''
# sht3x commands definations
# read serial number: CMD_READ_SERIALNBR 0x3780
# ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/floriculture/stm32/code/sht3x.py | Python | apache-2.0 | 3,599 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : cloudAI.py
@Description: 云端AI
@Author : jiangyu
@version : 1.0
'''
from aliyunIoT import Device
import utime # 延时函数在utime库中
import ujson as json
class CloudAI :
def __gesture_cb(self, dict) :
'''
Reply lis... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/fruit_scale/m5stack/code/cloudAI.py | Python | apache-2.0 | 10,770 |
from machine import Pin
from driver import GPIO
import utime
class Hx711(object):
def __init__(self, clkObj, dataObj):
self.clkObj = None
self.dataObj = None
if not isinstance(clkObj, GPIO):
raise ValueError("parameter is not an GPIO object")
if not isinstance(dataObj, G... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/fruit_scale/m5stack/code/ele_scale.py | Python | apache-2.0 | 1,971 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from driver import GPIO
from cloudAI import *
import display # 显示库
import network # 网络库
import ucamera # 摄像头库
import utime # 延时函数在utime库中
import sntp # 网络时间同步库
import ele_scale # 引入电子秤驱动库
import _thread # 线程库
# 全局变量
disp = None
fram... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/fruit_scale/m5stack/code/main.py | Python | apache-2.0 | 4,836 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : cloudAI.py
@Description: 云端AI
@Author : jiangyu
@version : 1.0
'''
from aliyunIoT import Device
import utime # 延时函数在utime库中
import ujson as json
class CloudAI :
def __gesture_cb(self, dict) :
'''
Reply lis... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/fruits_recognization/esp32/code/cloudAI.py | Python | apache-2.0 | 10,770 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 水果识别案例
@Author : luokui & jiangyu
@version : 2.0
'''
import display # 显示库
import network # 网络库
import ucamera # 摄像头库
import utime # 延时函数在utime库中
import sntp # 网络时间同步库
import _thread... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/fruits_recognization/esp32/code/main.py | Python | apache-2.0 | 4,771 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 燃气检测和报警灯控制
@Author : ethan.lcz
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/ESP-C3-32S-Kit/code/main.py | Python | apache-2.0 | 6,231 |
from driver import ADC
class MQ2(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getVoltage(self):
if self.adcObj is None:
raise... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/ESP-C3-32S-Kit/code/mq2.py | Python | apache-2.0 | 426 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 燃气检测和报警灯控制
@Author : ethan.lcz
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/ESP-S3-12K-Kit/code/main.py | Python | apache-2.0 | 6,231 |
from driver import ADC
class MQ2(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getVoltage(self):
if self.adcObj is None:
raise... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/ESP-S3-12K-Kit/code/mq2.py | Python | apache-2.0 | 426 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 燃气检测和报警灯控制
@Author : ethan.lcz
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/esp32/code/main.py | Python | apache-2.0 | 6,231 |
from driver import ADC
class MQ2(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getVoltage(self):
if self.adcObj is None:
raise... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/esp32/code/mq2.py | Python | apache-2.0 | 426 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 燃气检测和报警灯控制
@Author : victor.wang
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi 功能所在库
import utime # 延时API所在组件
import ujson # json字串解析... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/haas200/code/main.py | Python | apache-2.0 | 5,962 |
from driver import ADC
class MQ2(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getVoltage(self):
if self.adcObj is None:
raise ValueEr... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/haas200/code/mq2.py | Python | apache-2.0 | 410 |
# coding=utf-8
from driver import ADC
from driver import GPIO
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connect(data):
global module_name,default_ver,productKey,deviceName,deviceSecret,on_trigger,on_download,on_ve... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/haas506/code/main.py | Python | apache-2.0 | 5,335 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 燃气检测和报警灯控制
@Author : ethan.lcz
@version : 1.0
'''
from aliyunIoT import Device # aliyunIoT组件是连接阿里云物联网平台的组件
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import GPIO # 开发板 LED使用... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/haaseduk1/code/main.py | Python | apache-2.0 | 5,926 |
from driver import ADC
class MQ2(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getVoltage(self):
if self.adcObj is None:
raise ValueEr... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/haaseduk1/code/mq2.py | Python | apache-2.0 | 410 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 燃气检测和报警灯控制
@Author : victor.wang
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi 功能所在库
import utime # 延时API所在组件
import ujson ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/stm32/code/main.py | Python | apache-2.0 | 6,140 |
from driver import ADC
class MQ2(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getVoltage(self):
if self.adcObj is None:
raise ValueEr... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gas_detector/stm32/code/mq2.py | Python | apache-2.0 | 410 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : cloudAI.py
@Description: 云端AI
@Author : jiangyu
@version : 1.0
'''
from aliyunIoT import Device
import utime # 延时函数在utime库中
import ujson as json
class CloudAI :
def __gesture_cb(self, dict) :
'''
Reply lis... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gesture_recognization/m5stack/code/cloudAI.py | Python | apache-2.0 | 10,770 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 静态手势识别案例
@Author : 江遇
@version : 2.0
'''
import display # 显示库
import uai # AI识别库
import network # 网络库
import ucamera # 摄像头库
import utime # 延时函数在utime库中
import _thread # 线程库
im... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gesture_recognization/m5stack/code/main.py | Python | apache-2.0 | 4,442 |
# coding=utf-8
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
global deviceName,g_connect_status,device_dyn_resigter_succed,netw
g_connect_status = False
netw = None
device = None
deviceSecret = None
device_dyn_resigter_succed = False
#初始化物联网平台Device类,获取device实例... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gps_location_and_voicecall/code/aliyun.py | Python | apache-2.0 | 4,730 |
# !/usr/bin/python3
# -- coding: utf-8 --
# @Time : 2022/6/13 11:00 AM
# @Author : grady
from modem import voiceCall
from audio import Audio
import utime as time
from driver import GPIO
from driver import UART
import aliyun
import _thread
###############################
# 更改产品信息
productKey = "xxxxxxxx"
productSecret ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/gps_location_and_voicecall/code/main.py | Python | apache-2.0 | 4,491 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
"""
from driver import I2C
import kv
class HAASEDUK1(object):
def __init__(self):
self.i2cDev = None
# 获取版本号
# 返回值为1,代表k1c
# 返回值为0,代表k1
def getHWID(self):
hwId = -1
result = kv.geti("HAASEDU_NAME")
if (result... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/haas_radio/haaseduk1/code/haaseduk1.py | Python | apache-2.0 | 1,984 |
import utime
import sh1106
from driver import SPI
from driver import GPIO
from tea5767 import Radio
import framebuf
from driver import I2C
from haaseduk1 import HAASEDUK1
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import ujson # json字串解析库
board = HAASEDUK1() # 新建HAASEDUK1对象
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/haas_radio/haaseduk1/code/main.py | Python | apache-2.0 | 6,592 |
from micropython import const
import utime
import framebuf
from driver import SPI
from driver import GPIO
# register definitions
SET_SCAN_DIR = const(0xc0)
LOW_COLUMN_ADDRESS = const(0x00)
HIGH_COLUMN_ADDRESS = const(0x10)
SET_PAGE_ADDRESS = const(0xB0)
SET_CONTRAST = const(0x81)
SET_ENTIRE_ON = const(0xa4)
SET_NORM_I... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/haas_radio/haaseduk1/code/sh1106.py | Python | apache-2.0 | 7,916 |
import time
class Radio:
FREQ_RANGE_US = (87.5, 108.0)
FREQ_RANGE_JP = (76.0, 91.0)
ADC = (0, 5, 7, 10)
ADC_BIT = (0, 1, 2, 3)
def __init__(self, i2c, freq=0.0, band='US', stereo=True,
soft_mute=True, noise_cancel=True, high_cut=True):
self._i2c = i2c
sel... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/haas_radio/haaseduk1/code/tea5767.py | Python | apache-2.0 | 2,775 |
from driver import ADC
class HCHO(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getPPM(self):
if self.adcObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/ESP-C3-32S-Kit/code/hcho.py | Python | apache-2.0 | 950 |
# -*- encoding: utf-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
import hcho # 甲醛h... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/ESP-C3-32S-Kit/code/main.py | Python | apache-2.0 | 4,335 |
from driver import ADC
class HCHO(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getPPM(self):
if self.adcObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/ESP-S3-12K-Kit/code/hcho.py | Python | apache-2.0 | 950 |
# -*- encoding: utf-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
import hcho # 甲醛h... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/ESP-S3-12K-Kit/code/main.py | Python | apache-2.0 | 4,335 |
from driver import ADC
class HCHO(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getPPM(self):
if self.adcObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/esp32/code/hcho.py | Python | apache-2.0 | 950 |
# -*- encoding: utf-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
import hcho # 甲醛h... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/esp32/code/main.py | Python | apache-2.0 | 4,475 |
from driver import ADC
class HCHO(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getPPM(self):
if self.adcObj is None:
raise ValueError... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/haas200/code/hcho.py | Python | apache-2.0 | 939 |
# -*- encoding: utf-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi 功能所在库
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
import hcho # 甲醛... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/haas200/code/main.py | Python | apache-2.0 | 4,159 |
# coding=utf-8
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
from driver import UART
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connect(data):
global module_name,default_ver,productKey,deviceName,deviceSecret,on_trigger,on_download,on_verify,on_upgrade
print... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/haas506/code/main.py | Python | apache-2.0 | 5,247 |
from driver import ADC
class HCHO(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getPPM(self):
if self.adcObj is None:
raise ValueError... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/haaseduk1/code/hcho.py | Python | apache-2.0 | 946 |
# -*- encoding: utf-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
import hcho # 甲醛h... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/haaseduk1/code/main.py | Python | apache-2.0 | 4,234 |
from driver import ADC
class HCHO(object):
def __init__(self, adcObj):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueError("parameter is not an ADC object")
self.adcObj = adcObj
def getPPM(self):
if self.adcObj is None:
raise ValueError... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/stm32/code/hcho.py | Python | apache-2.0 | 939 |
# -*- encoding: utf-8 -*-
from ulinksdk.aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
import ujson # json字串解析库
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
import hcho ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/hcho_detector/stm32/code/main.py | Python | apache-2.0 | 4,243 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : bodyCalculator.py
@Description: bmi身体数据计算
@Author : aoyi
@version : 1.0
'''
MALE = 1
FEMALE = 2
ACTIVITY_SEDENTARY = 1
ACTIVITY_MILD_INTENSITY = 2
ACTIVITY_MIDDLE_INTENSITY = 3
ACTIVITY_HIGH_INTENSITY = 4
ACTIVITY_HEAVY_PHYSICAL_LABO... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/health_management/m5stack/code/bodyCalculator.py | Python | apache-2.0 | 4,471 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : cloudAI.py
@Description: 云端AI
@Author : jiangyu
@version : 1.0
'''
from aliyunIoT import Device
import utime # 延时函数在utime库中
import ujson as json
class CloudAI :
def __gesture_cb(self, dict) :
'''
Reply lis... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/health_management/m5stack/code/cloudAI.py | Python | apache-2.0 | 13,436 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 菜品识别
@Author : aoyi
@version : 1.0
'''
import display # 显示库
import network # 网络库
import ucamera # 摄像头库
import utime # 延时函数在utime库中
import _thread # 线程库
import sntp # 网络时间同步库
fr... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/health_management/m5stack/code/main.py | Python | apache-2.0 | 6,348 |
# -*- encoding: utf-8 -*-
'''
@File : heartbeat.py
@Description: 心率传感器驱动
@Author : victor.wang
@version : 1.0
'''
from driver import ADC # ADC类,通过微处理器的ADC模块读取ADC通道输入电压
from driver import TIMER # 定时器类,用于定时调用心率传感器
class HEARTBEAT (object):
de... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/heartrate_detector/esp32/code/heartbeat.py | Python | apache-2.0 | 5,841 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 心率上云
@Author : victor.wang
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
from driver import ADC # AD... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/heartrate_detector/esp32/code/main.py | Python | apache-2.0 | 6,821 |
from driver import PWM
class BUZZER(object):
def __init__(self, pwmObj,data=None):
self.pwmObj = None
if not isinstance(pwmObj, PWM):
raise ValueError("parameter is not an PWM object")
self.pwmObj = pwmObj
if data is not None:
self.setOptionDuty(data)
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/home_intrusion_alarm/esp32/code/buzzer.py | Python | apache-2.0 | 757 |
from driver import GPIO
class IR(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def irDetect(self):
if self.gpioObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/home_intrusion_alarm/esp32/code/ir.py | Python | apache-2.0 | 410 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Author : guoliang.wgl
@version : 1.0
@Description: home_intrusion_alarm案例 - 家庭红外入侵检测和报警系统
board.json - 硬件资源配置文件
'''
from buzzer import BUZZER
from ir import IR
from driver import PWM,GPIO
import time
from a... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/home_intrusion_alarm/esp32/code/main.py | Python | apache-2.0 | 5,681 |
from driver import GPIO
class BD(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def irDetect(self):
if self.gpioObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/home_intrusion_alarm/haas506/code/bodyDetect.py | Python | apache-2.0 | 410 |
# coding=utf-8
from driver import GPIO
from driver import PWM
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
import sntp
from bodyDetect import BD
# 警报开关以及时间段控制(大于等于alarm_start 或者小于等于alarm_end )
alarming = False
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connec... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/home_intrusion_alarm/haas506/code/main.py | Python | apache-2.0 | 7,089 |
from driver import GPIO
class IR(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def irDetect(self):
if self.gpioObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/esp32/code/ir.py | Python | apache-2.0 | 411 |
# -*- coding: UTF-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import ujson # json字串解析库
import utime # 延时API所在组件
from driver import GPIO # GPIO类,用于控制微处理器的输入输出功能
import ir # ir人体红外传感器类
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/esp32/code/main.py | Python | apache-2.0 | 4,669 |
from driver import GPIO
class IR(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def irDetect(self):
if self.gpioObj is None:
raise Val... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/haas200/code/ir.py | Python | apache-2.0 | 408 |
# -*- coding: UTF-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi 功能所在库
import ujson # json字串解析库
import utime # 延时API所在组件
from driver import GPIO # GPIO类,用于控制微处理器的输入输出功能
import ir # ir人体红外传感器类
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/haas200/code/main.py | Python | apache-2.0 | 5,011 |
# coding=utf-8
from driver import GPIO
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connect(data):
global module_name,default_ver,productKey,deviceName,deviceSecret,on_trigger,on_download,on_verify,on_upgrade
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/haas506/code/main.py | Python | apache-2.0 | 5,314 |
from driver import GPIO
class IR(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def irDetect(self):
if self.gpioObj is None:
raise Va... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/haaseduk1/code/ir.py | Python | apache-2.0 | 410 |
# -*- coding: UTF-8 -*-
from aliyunIoT import Device # aliyunIoT组件是连接阿里云物联网平台的组件
import netmgr as nm # Wi-Fi功能所在库
import ujson # json字串解析库
import utime # 延时API所在组件
from driver import GPIO # GPIO类,用于控制微处理器的输入输出功能
import ir # ir人体红外... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/haaseduk1/code/main.py | Python | apache-2.0 | 4,507 |
from driver import GPIO
class IR(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def irDetect(self):
if self.gpioObj is None:
raise Val... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/stm32/code/ir.py | Python | apache-2.0 | 408 |
# -*- coding: UTF-8 -*-
from ulinksdk.aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
#import netmgr as nm # Wi-Fi 功能所在库
import network
import ujson # json字串解析库
import utime # 延时API所在组件
from driver import GPIO # GPIO类,用于控制微处理器的输入输出功能
import ir ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_detector/stm32/code/main.py | Python | apache-2.0 | 5,098 |
from driver import GPIO
import utime as time
import audio
import radar
#创建并打开一个GPIO实例
gpiorDev=GPIO()
gpiorDev.open('radar')
#创建一个radar实例
radarDev=radar.RADAR(gpiorDev)
#创建并打开一个Audio实例
aud=audio.Audio()
#开启音频播放使能
aud.set_pa()
#设置音量
aud.setVolume(5)
#循环检测是否有人经过
while True:
if radarDev.detect()==1:
print("d... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_existence_detector/haas506/code/main.py | Python | apache-2.0 | 536 |
from driver import GPIO
class RADAR(object):
def __init__(self, gpioObj):
self.gpioObj = None
if not isinstance(gpioObj, GPIO):
raise ValueError("parameter is not a GPIO object")
self.gpioObj = gpioObj
def detect(self):
if self.gpioObj is None:
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_existence_detector/haas506/code/radar.py | Python | apache-2.0 | 437 |
from driver import PWM
class BUZZER(object):
def __init__(self, pwmObj):
self.pwmObj = None
if not isinstance(pwmObj, PWM):
raise ValueError("parameter is not an PWM object")
self.pwmObj = pwmObj
def setOptionDuty(self,data):
if self.pwmObj is None:
ra... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_ir_temperature/esp32/code/buzzer.py | Python | apache-2.0 | 668 |
#########
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import ujson
##################
from driver import I2C,PWM,TIMER
import utime
from ssd1306 import SSD1306_I2C
import buzzer
import mlx90614
import time
INVALUDE_TEMP = 1037 # 失效测量值
LOWER_LEVEL = 30 # 最小有效测温阈... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_ir_temperature/esp32/code/main.py | Python | apache-2.0 | 11,278 |
import ustruct
from driver import I2C
class SensorBase:
def read16(self, register):
data=bytearray(2)
self._i2cDev.memRead(data,register,8)
return ustruct.unpack('<H', data)[0]
def read_temp(self, register):
temp = self.read16(register)
temp *= .02
temp -= 273... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_ir_temperature/esp32/code/mlx90614.py | Python | apache-2.0 | 1,453 |
from micropython import const
import framebuf
from driver import I2C
# register definitions
SET_CONTRAST = const(0x81)
SET_ENTIRE_ON = const(0xa4)
SET_NORM_INV = const(0xa6)
SET_DISP = const(0xae)
SET_MEM_ADDR = const(0x20)
SET_COL_ADDR = const(0x21)
SET_PAGE_ADDR =... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/human_ir_temperature/esp32/code/ssd1306.py | Python | apache-2.0 | 3,565 |
import lvgl as lv
RESOURCES_ROOT = "S:/data/pyamp/"
lvglInitialized = False
class HumiturePanel:
container = None
scr = None
humidityValue = None
humidityLable = None
def __init__(self):
self.createPage()
def createPage(self):
global lvglInitialized
if lvglInitializ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/humiture_panel/m5stack/code/humiturePanel.py | Python | apache-2.0 | 4,853 |
from humiturePanel import HumiturePanel
import utime
import sht3x
from driver import I2C
# 创建I2C对象,用于创建I2C类型的温湿度设备
i2cObj = I2C()
# 打开I2C对象
i2cObj.open("sht3x")
# 创建SHT3X温湿度传感器对象
humitureDev = sht3x.SHT3X(i2cObj)
print('create humiture device')
humiturePage = HumiturePanel()
print('create humiture panel')
while Tru... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/humiture_panel/m5stack/code/main.py | Python | apache-2.0 | 654 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for CHT8305
Author: HaaS
Date: 2021/09/14
"""
from micropython import const
import utime
from driver import I2C
'''
# sht3x commands definations
# read serial number: CMD_READ_SERIALNBR 0x3780
# ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/humiture_panel/m5stack/code/sht3x.py | Python | apache-2.0 | 4,279 |
# -*- coding: UTF-8 -*-
import net
import http
import ujson
class LBS():
def __init__(self):
self.requesturl = ''
self.url = 'http://apilocate.amap.com/position'
self.accesstype = 0
#input your key here
self.key = 'yourKey'
self.cdma = 0
self.output = 'json'
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/lbs_demo/haas506/code/lbs.py | Python | apache-2.0 | 2,988 |
import utime as time
import network
from lbs import LBS
g_connect_status = False
def on_4g_cb(args):
global g_connect_status
pdp = args[0]
netwk_sta = args[1]
if netwk_sta == 1:
g_connect_status = True
else:
g_connect_status = False
def connect_network():
global net,on_4g_cb... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/lbs_demo/haas506/code/main.py | Python | apache-2.0 | 945 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : cloudAI.py
@Description: 云端AI
@Author : jiangyu
@version : 1.0
'''
from aliyunIoT import Device
import utime # 延时函数在utime库中
import ujson as json
class CloudAI :
def __gesture_cb(self, dict) :
'''
Reply lis... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/license_plate_recognization/esp32/code/cloudAI.py | Python | apache-2.0 | 10,770 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 车牌识别案例
@Author : luokui & jiangyu
@version : 2.0
'''
import display # 显示库
import network # 网络库
import ucamera # 摄像头库
import utime # 延时函数在utime库中
import _thread # 线程库
import sntp ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/license_plate_recognization/esp32/code/main.py | Python | apache-2.0 | 4,492 |
from driver import GPIO
from time import sleep
class Buzzer:
def __init__(self, io_name) -> None:
self.gpio = GPIO()
ret = self.gpio.open(io_name)
if ret < 0:
raise Exception("Error opening gpio ", io_name, " ret=", ret)
ret = self.gpio.write(0)
if ret < 0:
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/local_gesture_recognize/esp32/code/buzzer.py | Python | apache-2.0 | 528 |
# 本地手势识别
######################
#### 请修改此处信息 ####
PRODUCT_KEY = '这里填写产品PK'
DEVICE_NAME = '这里填入设备名称DN'
DEVICE_SECRET = '这里填入设备密钥DS'
WIFI_SSID = 'WiFi名称'
WIFI_PWD = 'WiFi密码'
######################
# 导入框架模块
from time import sleep
import ujson as json
import network
import kv
from aliyunIoT import Device
# 导入工程内驱动模块
fro... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/local_gesture_recognize/esp32/code/main.py | Python | apache-2.0 | 3,980 |
from driver import I2C
from driver import GPIO
from time import sleep
from uasyncio import run
class Gesture:
WAVE = 0
UP = 1
DOWN = 2
LEFT = 4
RIGHT = 8
FORWARD = 16
BACKWARD = 32
CLOCKWISE = 64
ANTICLOCKWISE = 128
_REG_INIT_LIST = [
[0xEF, 0x00],
[0x41, 0x00]... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/local_gesture_recognize/esp32/code/paj7620.py | Python | apache-2.0 | 3,541 |
#########
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import ujson
##################
import utime # 延时函数在utime库中
from math import pi
from driver import I2C
import pca9685
robotDev = None
#########
# 物联网平台连接标志位
iot_connected = False
wlan = None
# 三元组信息
prod... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/machine_arm/esp32/code/main.py | Python | apache-2.0 | 4,411 |
import time
from ustruct import pack
from math import pi
from driver import I2C
import math
class PCA9685:
def __init__(self, i2cDev):
self._i2c = None
if not isinstance(i2cDev, I2C):
raise ValueError("parameter is not an I2C object")
self._i2c = i2cDev
self.freq = 50 #... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/machine_arm/esp32/code/pca9685.py | Python | apache-2.0 | 1,217 |
# -*- encoding: utf-8 -*-
from music import MusicPlayer
player = MusicPlayer()
player.createPage()
print('Music Player started')
my_music = {
"title":"spring_short",
"album":"Darius",
"album_url": '',
"url":"file://data/pyamp/spring.mp3",
"duration":30,
"favorite": False
}
player.addToList(my... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/music_player/code/main.py | Python | apache-2.0 | 366 |
import lvgl as lv
from axp192 import *
from audio import Player
RESOURCES_ROOT = "S:/data/pyamp/"
functionImage = [
RESOURCES_ROOT + 'images/' + "prev.png",
RESOURCES_ROOT + 'images/' + "play.png",
RESOURCES_ROOT + 'images/' + "next.png",
RESOURCES_ROOT + 'images/' + "favorite.png"]
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/music_player/code/music.py | Python | apache-2.0 | 12,399 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 声音上云
@Author : victor.wang
@version : 1.0
'''
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
from driver import ADC # ADC... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/noise_detector/esp32/code/main.py | Python | apache-2.0 | 6,981 |
'''
Copyright (C) 2015-2022 Alibaba Group Holding Limited
MicroPython's driver for Noise
Author: HaaS
Date: 2022/03/23
'''
from driver import ADC
class Noise(object):
def __init__(self, adcObj, avgSz=100):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueErr... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/noise_detector/esp32/code/noise.py | Python | apache-2.0 | 1,262 |
# coding=utf-8
from driver import ADC
from driver import GPIO
from driver import PWM
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
import math
import _thread
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connect(data):
global module_name,default_ver,productKey,devi... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/noise_detector/haas506/code/main.py | Python | apache-2.0 | 7,474 |
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 声音上云
@Author : victor.wang
@version : 1.0
'''
from ulinksdk.aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import utime # 延时API所在组件
from driver import ADC ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/noise_detector/stm32/code/main.py | Python | apache-2.0 | 6,868 |
'''
Copyright (C) 2015-2022 Alibaba Group Holding Limited
MicroPython's driver for Noise
Author: HaaS
Date: 2022/03/23
'''
from driver import ADC
class Noise(object):
def __init__(self, adcObj, avgSz=100):
self.adcObj = None
if not isinstance(adcObj, ADC):
raise ValueErr... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/noise_detector/stm32/code/noise.py | Python | apache-2.0 | 1,262 |
from driver import PWM
class BUZZER(object):
def __init__(self, pwmObj):
self.pwmObj = None
if not isinstance(pwmObj, PWM):
raise ValueError("parameter is not an PWM object")
self.pwmObj = pwmObj
def setOptionDuty(self,data):
if self.pwmObj is None:
ra... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/esp32/code/buzzer.py | Python | apache-2.0 | 668 |
from time import sleep_us,ticks_us
from driver import GPIO
class HCSR04():
def __init__(self,trigObj,echoObj):
self.trig = None
self.echo = None
if not isinstance(trigObj, GPIO):
raise ValueError("parameter is not a GPIO object")
if not isinstance(echoObj, GPIO):
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/esp32/code/hcsr04.py | Python | apache-2.0 | 1,047 |
# -*- coding: UTF-8 -*-
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import ujson # json字串解析库
import utime # 延时API所在组件
from driver import GPIO # GPIO类,用于控制微处理器的输入输出功能
import hcsr04 # hcsr04超声波传感器... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/esp32/code/main.py | Python | apache-2.0 | 4,346 |
# coding=utf-8
from driver import GPIO
from driver import PWM
import network
import _thread
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connect(data):
global module_name,default_ver,productKey,deviceName,deviceSecret,on_trigger,on_d... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/haas506/code/main.py | Python | apache-2.0 | 7,691 |
from driver import PWM
class BUZZER(object):
def __init__(self, pwmObj):
self.pwmObj = None
if not isinstance(pwmObj, PWM):
raise ValueError("parameter is not an PWM object")
self.pwmObj = pwmObj
def setOptionDuty(self,data):
if self.pwmObj is None:
ra... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/stm32/code/buzzer.py | Python | apache-2.0 | 668 |
from time import sleep_us,ticks_us
from driver import GPIO
class HCSR04():
def __init__(self,trigObj,echoObj):
self.trig = None
self.echo = None
if not isinstance(trigObj, GPIO):
raise ValueError("parameter is not a GPIO object")
if not isinstance(echoObj, GPIO):
... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/stm32/code/hcsr04.py | Python | apache-2.0 | 1,047 |
# -*- coding: UTF-8 -*-
from ulinksdk.aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import ujson # json字串解析库
import utime # 延时API所在组件
from driver import GPIO # GPIO类,用于控制微处理器的输入输出功能
import hcsr04 # hcs... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/obstacle_avoidance/stm32/code/main.py | Python | apache-2.0 | 4,353 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : cloudAI.py
@Description: 云端AI
@Author : jiangyu
@version : 1.0
'''
from aliyunIoT import Device
import utime # 延时函数在utime库中
import ujson as json
class CloudAI :
def __gesture_cb(self, dict) :
'''
Reply lis... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/pedestrian_detection/esp32/code/cloudAI.py | Python | apache-2.0 | 10,770 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Description: 人体检测案例
@Author : luokui & jiangyu
@version : 2.0
'''
import display # 显示库
import network # 网络库
import ucamera # 摄像头库
import utime # 延时函数在utime库中
import _thread # 线程库
import sntp ... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/pedestrian_detection/esp32/code/main.py | Python | apache-2.0 | 4,365 |
# -*- encoding: utf-8 -*-
from driver import GPIO
from uln2003 import *
if __name__ == '__main__':
relay_dev = GPIO()
relay_dev.open('relay')
a = GPIO()
a.open('uln2003_a')
a_ = GPIO()
a_.open('uln2003_a_')
b = GPIO()
b.open('uln2003_b')
b_ = GPIO()
b_.open('uln2003_b_')
mo... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/playing_with_cats/nodemcu32s/code/main.py | Python | apache-2.0 | 927 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for ULN2003
Author: HaaS
Date: 2022/03/15
"""
from driver import GPIO
from utime import sleep_ms
from micropython import const
import math
class ULN2003(object):
"""
This class implements uln2003 chip's defs.
"... | YifuLiu/AliOS-Things | haas_lib_bundles/python/docs/examples/playing_with_cats/nodemcu32s/code/uln2003.py | Python | apache-2.0 | 2,207 |