>>> 星瞳科技|OpenMV中国官方网站 <<<

>>> 星瞳科技店铺地址|OpenMV中国官方代理,全球九大代理商之一 <<<

>>> OpenMV3 Cam M7 官方高配版上市啦~戳我戳我戳我~ <<<

>>> 星瞳科技-OpenMV中文教程网 <<<

本例程为01-Basics-main.py

# Main Module Example
#

# When your OpenMV Cam is disconnected from your computer it will either run the

# main.py script on the SD card (if attached) or the main.py script on

# your OpenMV Cam's internal flash drive.

import time, pyb

#将蓝灯赋值给变量led
led = pyb.LED(3) # Red LED = 1, Green LED = 2, Blue LED = 3, IR LEDs = 4.
usb = pyb.USB_VCP() # This is a serial port object that allows you to

# communciate with your computer. While it is not open the code below runs.

#如果openmv未连接到电脑,蓝灯亮150ms,延时100ms,亮150ms,延时600ms,循环。
while(not usb.isconnected()):
    led.on()            #亮灯    
    time.sleep(150)     #延时150ms    
    led.off()           #暗灯    
    time.sleep(100)
    led.on()
    time.sleep(150)
    led.off()
    time.sleep(600)

#变量led此时代表绿灯
led = pyb.LED(2) # Switch to using the green LED.

#如果openmv已连接到电脑
while(usb.isconnected()):
    led.on()
    time.sleep(150)
    led.off()
    time.sleep(100)
    led.on()
    time.sleep(150)
    led.off()
    time.sleep(600)