导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 5g6h
    5
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    5g6h

    @5g6h

    0
    声望
    1
    楼层
    301
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    5g6h 关注

    5g6h 发布的帖子

    • 为什么识别不了输入的a来拍照呀,
      from pyb import UART
      
      uart = UART(3, 9600, timeout_char=1000)                         # i使用给定波特率初始化
      uart.init(9600, bits=8, parity=None, stop=1, timeout_char=1000) # 使用给定参数初始化
      
      # Snapshot Example
      #
      # Note: You will need an SD card to run this example.
      #
      # You can use your OpenMV Cam to save image files.
      
      import sensor, image, pyb,sensor, gif,time,utime
      
      RED_LED_PIN = 1
      BLUE_LED_PIN = 3
      
      sensor.reset() # Initialize the camera sensor.
      sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
      sensor.skip_frames(time = 2000) # Let new settings take affect.
      
      while(True):
          if not uart.any():
              # 啥事儿不干
              sensor.snapshot()
              time.sleep(100)
      
          else:
              a=uart.readline()
              print(a)
      
              if a=='12\n':
                  pyb.LED(RED_LED_PIN).on()
                  sensor.skip_frames(time = 2000) # Give the user time to get ready.
                  pyb.LED(RED_LED_PIN).off()
                  pyb.LED(BLUE_LED_PIN).on()
                  print("You're on camera!")
                  sensor.snapshot().save("example_tupian.jpg") # or "example.bmp" (or others)
                  pyb.LED(BLUE_LED_PIN).off()
                  print("Done! Reset the camera to see the saved image.")
      
              else:
                  pyb.LED(RED_LED_PIN).on()
                  sensor.skip_frames(time = 2000) # Give the user time to get ready.
                  pyb.LED(RED_LED_PIN).off()
                  pyb.LED(BLUE_LED_PIN).on()
      
                  g = gif.Gif("example.gif", loop=True)
      
                  print("You're on camera2!")
                  for i in range(300):
      
                   # clock.avg() returns the milliseconds between frames - gif delay is in
                      g.add_frame(sensor.snapshot()) # centiseconds.
      
                  g.close()
                  pyb.LED(BLUE_LED_PIN).off()
                  print("Done! Reset the camera to see the saved recording.")
      
      

      0_1554819102607_QQ图片20190409221130.png
      不管怎么输入a 都是选择了else

      发布在 OpenMV Cam
      5
      5g6h