openmv的就是例程给的没换
下面是电脑上的,有点随机,卡住的几率大,偶尔能保存图
import requests
num = 0
while(True):
cmd = input('s = snap; e = end\n') #键盘输入s 为拍摄命令 e 为结束
num += 1
print('num')
if (cmd == 's'):
resp = requests.get("http://192.168.1.1:8080",timeout=(1,1)) #卡这里!!!
print('num2')
img = resp.content #接收openmv发送的数据
print('num3')
with open("D:\mycode\openmv\smd_by_openmv\img"+str(num)+".jpg", "wb") as f: #保存img
print('num4')
f.write(img)
print('num5')
elif (cmd == 'e'):
break