星瞳实验室APP,快速收到回复
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 为什么识别不了输入的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



    • 按照教程操作。
      https://singtown.com/learn/50240/