导航

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

    bnly

    @bnly

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

    bnly 关注

    bnly 发布的帖子

    • RE: 连接上wifi扩展板之后运行程序,其他设备识别不到OPENMV_AP热点是什么原因

      @kidswong999 好的

      发布在 OpenMV Cam
      B
      bnly
    • RE: 连接上wifi扩展板之后运行程序,其他设备识别不到OPENMV_AP热点是什么原因

      @kidswong999 是的

      发布在 OpenMV Cam
      B
      bnly
    • RE: 连接上wifi扩展板之后运行程序,其他设备识别不到OPENMV_AP热点是什么原因

      使用的就是官方给的例程,没做改动

      发布在 OpenMV Cam
      B
      bnly
    • 连接上wifi扩展板之后运行程序,其他设备识别不到OPENMV_AP热点是什么原因
      # MJPEG Streaming AP.
      #
      # This example shows off how to do MJPEG streaming in AccessPoint mode.
      # Chrome, Firefox and MJpegViewer App on Android have been tested.
      # Connect to OPENMV_AP and use this URL: http://192.168.1.1:8080 to view the stream.
      
      import sensor, image, time, network, usocket, sys
      
      SSID ='OPENMV_AP'    # Network SSID
      KEY  ='1234567890'    # Network key (must be 10 chars)
      HOST = ''           # Use first available interface
      PORT = 8080         # Arbitrary non-privileged port
      
      # Reset sensor
      sensor.reset()
      sensor.set_framesize(sensor.QQVGA)
      sensor.set_pixformat(sensor.GRAYSCALE)
      
      # Init wlan module in AP mode.
      wlan = network.WINC(mode=network.WINC.MODE_AP)
      wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)
      print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))
      
      # You can block waiting for client to connect
      #print(wlan.wait_for_sta(10000))
      
      def start_streaming(s):
          print ('Waiting for connections..')
          client, addr = s.accept()
          # set client socket timeout to 2s
          client.settimeout(2.0)
          print ('Connected to ' + addr[0] + ':' + str(addr[1]))
      
          # Read request from client
          data = client.recv(1024)
          # Should parse client request here
      
          # Send multipart header
          client.send("HTTP/1.1 200 OK\r\n" \
                      "Server: OpenMV\r\n" \
                      "Content-Type: multipart/x-mixed-replace;boundary=openmv\r\n" \
                      "Cache-Control: no-cache\r\n" \
                      "Pragma: no-cache\r\n\r\n")
      
          # FPS clock
          clock = time.clock()
      
          # Start streaming images
          # NOTE: Disable IDE preview to increase streaming FPS.
          while (True):
              clock.tick() # Track elapsed milliseconds between snapshots().
              frame = sensor.snapshot()
              cframe = frame.compressed(quality=35)
              header = "\r\n--openmv\r\n" \
                       "Content-Type: image/jpeg\r\n"\
                       "Content-Length:"+str(cframe.size())+"\r\n\r\n"
              client.send(header)
              client.send(cframe)
              print(clock.fps())
      
      while (True):
          # Create server socket
          s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
          try:
              # Bind and listen
              s.bind([HOST, PORT])
              s.listen(5)
      
              # Set server socket timeout
              # NOTE: Due to a WINC FW bug, the server socket must be closed and reopened if
              # the client disconnects. Use a timeout here to close and re-create the socket.
              s.settimeout(3)
              start_streaming(s)
          except OSError as e:
              s.close()
              print("socket error: ", e)
              #sys.print_exception(e)
      
      
      发布在 OpenMV Cam
      B
      bnly