@kidswong999 5fpd 大约14小时之前
openmv 串行终端有数据,接的线是p4-10 P5-11 代码就是openmv官网的串行通信下,然后如果我接的arduino 0 1 (rxtx)的话就可以在看到数据了,不知道为啥子接10 11引脚就不行了,我估计是openmv的输入的数据格式有问题,please帮忙看一下
5
5fpd 发布的帖子
-
RE: openmv和arduino 串口通信 为什么发送的数据在arduino 串口监视器上只有横线啊
-
RE: openmv和arduino 串口通信 为什么发送的数据在arduino 串口监视器上只有横线啊
openmv 串行终端有数据,接的线是p4-10 P5-11 代码就是openmv官网的串行通信下,然后如果我接的arduino 0 1 (rxtx)的话就可以在看到数据了,不知道为啥子接10 11引脚就不行了,我估计是openmv的输入的数据格式有问题,please帮忙看一下
-
openmv和arduino 串口通信 为什么发送的数据在arduino 串口监视器上只有横线啊
# Blob Detection and uart transport import sensor, image, time from pyb import UART import json # For color tracking to work really well you should ideally be in a very, very, # very, controlled enviroment where the lighting is constant... yellow_threshold = (65, 100, -100, 10, 24, 51) # You may need to tweak the above settings for tracking green things... # Select an area in the Framebuffer to copy the color settings. sensor.reset() # 初始化摄像头 sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565. sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) # 跳过10帧,使新设置生效 sensor.set_auto_whitebal(False) # Create a clock object to track the FPS. uart = UART(3, 115200) ROI=(80,30,15,15) while(True): img = sensor.snapshot() # Take a picture and return the image. statistics=img.get_statistics(roi=ROI) #color_l=statistics.l_mode() color_a=statistics.a_mode() if statistics.a_mode()>0: color_a=0 else: color_a=1 #color_b=statistics.b_mode() print(color_a) data=[] data.append(color_a) data_out = json.dumps(set(data)) img.draw_rectangle(ROI) #uart.write(str(color_a)) print('you send:',data_out) uart.write(data_out +'\n')
#arduino部分
#include <SoftwareSerial.h> SoftwareSerial softSerial(10, 11); // RX, TX typedef struct { int data[50][2] = {{0,0}}; int len = 0; }List; List list; void setup() { // put your setup code here, to run once: softSerial.begin(115200); Serial.begin(115200); } void loop() { if(softSerial.available()) { getList(); for (int i=0; i<list.len; i++) { Serial.print(list.data[i][0]); Serial.print('\t'); Serial.println(list.data[i][1]); } Serial.println("============"); clearList(); } } String detectString() { while(softSerial.read() != '{'); return(softSerial.readStringUntil('}')); } void clearList() { memset(list.data, sizeof(list.data),0); list.len = 0; } void getList() { String s = detectString(); String numStr = ""; for(int i = 0; i<s.length(); i++) { if(s[i]=='('){ numStr = ""; } else if(s[i] == ','){ list.data[list.len][0] = numStr.toInt(); numStr = ""; } else if(s[i]==')'){ list.data[list.len][1] = numStr.toInt(); numStr = ""; list.len++; } else{ numStr += s[i]; } } }
-
openmv~arduino~esp8266~贝壳物联
我最近的任务是通过openmv和arduino串口通信,然后利用esp8266把arduino端接受到的数据上传到贝壳物联,现在有一个问题就是我把openmv和arduino电路连接openmvp4p5接arduinoRXTX,但是同时arduino还要接esp8266的RXTX,这该咋办,我尝试接了arduino的10 11引脚,但是怎么把arduino串口监视器上的数据传到云端啊?像一般的传感器都是接一个引脚,然后代码是直接读取这个引脚就行了,而openmv要接两个引脚,这在代码是要怎么实现啊?
-
这段代码怎么调整,我的目的是把它的数据发送到arduino端的串口监视器器
# Blob Detection and uart transport import sensor, image, time from pyb import UART import json # For color tracking to work really well you should ideally be in a very, very, # very, controlled enviroment where the lighting is constant... yellow_threshold = (65, 100, -10, 60, 24, 51) # You may need to tweak the above settings for tracking green things... # Select an area in the Framebuffer to copy the color settings. sensor.reset() # 初始化摄像头 sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565. sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) # 跳过10帧,使新设置生效 sensor.set_auto_whitebal(False) # Create a clock object to track the FPS. ROI=(80,30,15,15) uart = UART(3, 115200) while(True): img = sensor.snapshot() # Take a picture and return the image. statistics=img.get_statistics(roi=ROI) #color_l=statistics.l_mode() color_a=statistics.a_mode() output_str="" % (statistics.a_mode()) #color_b=statistics.b_mode() print(color_a) img.draw_rectangle(ROI) uart.write(statistics.a_mode())
-
我想问一下我这个if函数的语法有错误吗?
import sensor, image, time sensor.reset() # 初始化摄像头 sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565. sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) # 跳过10帧,使新设置生效 sensor.set_auto_whitebal(False) # Create a clock object to track the FPS. ROI=(80,30,15,15) while(True): img = sensor.snapshot() # Take a picture and return the image. statistics=img.get_statistics(roi=ROI) #color_l=statistics.l_mode() color_a=statistics.a_mode() #color_b=statistics.b_mode() if (statistics.a_mode()>0): color_a=1 else: color_a=0 print(color_a) img.draw_rectangle(ROI)
-
就是我之前下载的openmv ide我把它卸载了之后重新下载下来就无法启动了,这该怎么办。
就是我之前下载的openmv ide我把它卸载了之后重新下载下来就无法启动了,这该怎么办。