@@ -0,0 +1,2634 @@
+# MJPEG Streaming AP.%0A#%0A# This example shows off how to do MJPEG streaming in AccessPoint mode.%0A# Chrome, Firefox and MJpegViewer App on Android have been tested.%0A# Connect to OPENMV_AP and use this URL: http://192.168.1.1:8080 to view the stream.%0A%0Aimport sensor, image, time, network, usocket, sys%0A%0ASSID ='OPENMV_AP'    # Network SSID%0AKEY  ='1234567890'    # Network key (must be 10 chars)%0AHOST = ''           # Use first available interface%0APORT = 8080         # Arbitrary non-privileged port%0A%0A# Reset sensor%0Asensor.reset()%0A# Set sensor settings%0Asensor.set_contrast(1)%0Asensor.set_brightness(1)%0Asensor.set_saturation(1)%0Asensor.set_gainceiling(16)%0Asensor.set_framesize(sensor.QQVGA)%0Asensor.set_pixformat(sensor.GRAYSCALE)%0A%0A# Init wlan module in AP mode.%0Awlan = network.WINC(mode=network.WINC.MODE_AP)%0Awlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)%0A%0A# You can block waiting for client to connect%0A#print(wlan.wait_for_sta(10000))%0A%0Adef start_streaming(s):%0A    print ('Waiting for connections..')%0A    client, addr = s.accept()%0A    # set client socket timeout to 2s%0A    client.settimeout(2.0)%0A    print ('Connected to ' + addr%5B0%5D + ':' + str(addr%5B1%5D))%0A%0A    # Read request from client%0A    data = client.recv(1024)%0A    # Should parse client request here%0A%0A    # Send multipart header%0A    client.send(%22HTTP/1.1 200 OK%5Cr%5Cn%22 %5C%0A                %22Server: OpenMV%5Cr%5Cn%22 %5C%0A                %22Content-Type: multipart/x-mixed-replace;boundary=openmv%5Cr%5Cn%22 %5C%0A                %22Cache-Control: no-cache%5Cr%5Cn%22 %5C%0A                %22Pragma: no-cache%5Cr%5Cn%5Cr%5Cn%22)%0A%0A    # FPS clock%0A    clock = time.clock()%0A%0A    # Start streaming images%0A    # NOTE: Disable IDE preview to increase streaming FPS.%0A    while (True):%0A        clock.tick() # Track elapsed milliseconds between snapshots().%0A        frame = sensor.snapshot()%0A        cframe = frame.compressed(quality=35)%0A        header = %22%5Cr%5Cn--openmv%5Cr%5Cn%22 %5C%0A                 %22Content-Type: image/jpeg%5Cr%5Cn%22%5C%0A                 %22Content-Length:%22+str(cframe.size())+%22%5Cr%5Cn%5Cr%5Cn%22%0A        client.send(header)%0A        client.send(cframe)%0A        print(clock.fps())%0A%0Awhile (True):%0A    # Create server socket%0A    s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)%0A    try:%0A        # Bind and listen%0A        s.bind(%5BHOST, PORT%5D)%0A        s.listen(5)%0A%0A        # Set server socket timeout%0A        # NOTE: Due to a WINC FW bug, the server socket must be closed and reopened if%0A        # the client disconnects. Use a timeout here to close and re-create the socket.%0A        s.settimeout(3)%0A        start_streaming(s)%0A    except OSError as e:%0A        s.close()%0A        print(%22socket error: %22, e)%0A        #sys.print_exception(e)%0A

Add MJPEG AP mode example script.