I use rtsp(video streaming) example as boot.py for freeze on Arduino Nicla Vision board. The program is built from latest OpenMV source(commit 4624af1). But I find LED always blink blue, which indicate trying to connect to WiFi. The rtsp example works fine in OpenMV IDE when connect to same wireless network. I use oneplus 9 smartphone as hotspot.
Can you provide the script that you are trying to freeze? I’ll test it out.
import network
import rtsp
import csi
import time
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)
network_if = network.WLAN(network.STA_IF)
network_if.active(True)
network_if.connect(“oneplus9”, “”) # replace password
while not network_if.isconnected():
print(“Trying to connect. Note this may take a while…”)
time.sleep_ms(1000)
server = rtsp.rtsp_server(network_if)
clock = time.clock()
def setup_callback(pathname, session):
print(‘Opening “%s” in session %d’ % (pathname, session))
def play_callback(pathname, session):
global clock
clock.reset()
clock.tick()
print(‘Playing “%s” in session %d’ % (pathname, session))
def pause_callback(pathname, session): # VLC only pauses locally. This is never called.
print(‘Pausing “%s” in session %d’ % (pathname, session))
def teardown_callback(pathname, session):
print(‘Closing “%s” in session %d’ % (pathname, session))
server.register_setup_cb(setup_callback)
server.register_play_cb(play_callback)
server.register_pause_cb(pause_callback)
server.register_teardown_cb(teardown_callback)
def image_callback(pathname, session):
global csi0
global clock
img = csi0.snapshot(update=False)
print(clock.fps())
clock.tick()
return img
server.stream(image_callback, quality=70)
It’s the rtsp example provided by OpenMV IDE
import network
import rtsp
import csi
import time
from machine import LED
red = LED("LED_RED")
green = LED("LED_GREEN")
blue = LED("LED_BLUE")
# Red: initializing camera
red.on()
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)
red.off()
# Blue: connecting to WiFi
blue.on()
network_if = network.WLAN(network.STA_IF)
network_if.active(True)
network_if.connect("", "") # replace password
while not network_if.isconnected():
print("Trying to connect. Note this may take a while...")
blue.toggle()
time.sleep_ms(1000)
blue.off()
# Green: server ready / streaming
green.on()
server = rtsp.rtsp_server(network_if)
clock = time.clock()
def setup_callback(pathname, session):
print('Opening "%s" in session %d' % (pathname, session))
def play_callback(pathname, session):
global clock
clock.reset()
clock.tick()
print('Playing "%s" in session %d' % (pathname, session))
def pause_callback(pathname, session): # VLC only pauses locally. This is never called.
print('Pausing "%s" in session %d' % (pathname, session))
def teardown_callback(pathname, session):
print('Closing "%s" in session %d' % (pathname, session))
server.register_setup_cb(setup_callback)
server.register_play_cb(play_callback)
server.register_pause_cb(pause_callback)
server.register_teardown_cb(teardown_callback)
def image_callback(pathname, session):
global csi0
global clock
img = csi0.snapshot()
print(clock.fps())
clock.tick()
return img
server.stream(image_callback, quality=70)
Remove the update=False argument. There’s an API change for the latest code.
Hi,kwagyeman
Can you reproduce the situation. I am not sure whether there are any compatible reasons among different WiFi router/AP devices.
It was just that argument causing the script to crash.
Hi,kwagyeman
Thanks for your help. I can make Nicla Vision work now. I forgot to edit board’s manifest file, so my boot program is actually the default _boot.py.