L
lrys 发布的帖子
-
RE: wifi图传视频流的例程报错
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() # Set sensor settings sensor.set_framesize(sensor.QQVGA) sensor.set_pixformat(sensor.RGB565) # Init wlan module in AP mode. wlan = network.WLAN(network.AP_IF) wlan.config(ssid=SSID, key=KEY, channel=2) wlan.active(True) # You can block waiting for client to connect #print(wlan.wait_for_sta(10000)) def response(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: image/jpeg\r\n\r\n") # FPS clock clock = time.clock() # Start streaming images # NOTE: Disable IDE preview to increase streaming FPS. frame = sensor.snapshot() cframe = frame.compressed(quality=35) client.send(cframe) client.close() while (True): # Create server socket s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM) sensor.snapshot() img.save("%s.jpg"%tim) 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) response(s) except OSError as e: s.close() print("socket error: ", e) #sys.print_exception(e) ![0_1718268280063_1.png](https://fcdn.singtown.com/e0b06a29-548c-49f6-b6df-545dc031597c.png)
-
wifi图传视频流的例程报错
为什么直接使用上手教程中的“14-WiFi-Shield->mjpeg_streamer_ap 热点”程序,运行时候有错,显示image没有“compressed”