pyb各种外设 · OpenMV中文入门教程
https://book.openmv.cc/MCU/pyb.htmlfrom pyb import Pin, Timer p = Pin('P7') # P7 has TIM4, CH1 tim = Timer(4, freq= 1000) ch = tim.channel(1, Timer.PWM, pin=p) ch.pulse_width_percent(50) ADC from pyb import Pin, ADC adc = ADC('P6') adc.read() # read value, 0-4095 DAC from pyb import Pin, DAC dac = DAC('P6') dac.write(120) # output between 0 and 255 UART
Python pyb.Pin方法代码示例 - 纯净天空
https://vimsky.com/examples/detail/python-method-pyb.Pin.html# 需要导入模块: import pyb [as 别名] # 或者: from pyb import Pin [as 别名] def setup(): global uart, gps # For shutdown red = pyb.LED(1) blue = pyb.LED(4) sreader = asyncio.StreamReader(uart) swriter = asyncio.StreamWriter(uart, {}) pps_pin = pyb.Pin(PPS_PIN, pyb.Pin.IN) gps = GPS_RWTimer(sreader, swriter, pps_pin, local_offset=1, fix_cb=lambda *_: red.toggle(), …