OP90 Unit

支持以下产品

OP90

Micropython Example:

import os, sys, io
import M5
from M5 import *
from hardware import *
import time
from unit import *

i2c0 = None
op90_0 = None

def setup():
global i2c0, op90_0

i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
op90_0 = OPUnit((8, 9), type=1)
M5.begin()
Widgets.fillScreen(0x222222)

print(op90_0.get_value)
time.sleep(1)
print(op90_0.count_value)
time.sleep(1)
op90_0.count_reset()
time.sleep(1)

UIFLOW2 Example:

example.svg

op90_core_example.m5f2

class OPUnit

Constructors

class OPUnit(io)

创建一个OPUnit对象

参数如下:
  • io 为检测引脚。

UIFLOW2:

init.svg

Methods

OPUnit.count_value()

获取计数值。

UIFLOW2:

get_count_value.svg

OPUnit.count_reset()

重置计数值。

UIFLOW2:

reset_count_value.svg