@kidswong999 那是什么问题。。。前两天用过没事,也没搞其他东西
Y
yq6r
@yq6r
0
声望
6
楼层
521
资料浏览
0
粉丝
0
关注
yq6r 发布的帖子
-
RE: 想问arduino如何跟openmv通讯?
@kidswong999 有串口传输吧,arduino的串口监视器收到openmv发送的字符
那个openmvif uart.any(): print("thatsgood") tmp_data = uart.readchar() uart.write("RECIVED : %s\n"%tmp_data) print(tmp_data)
也输出了thatsgood,说明他串口接收到了数据,但却输出不了字符,只输出乱码-1
-
RE: 想问arduino如何跟openmv通讯?
#include <Servo.h> #include <SoftwareSerial.h> SoftwareSerial mySerial(0,1); void setup() { // put your setup code here, to run once: Serial.begin(9600); mySerial.begin(9600); } void loop() { // put your main code here, to run repeatedly: char val; Serial.flush(); if(Serial.available()>0){ val = Serial.read(); Serial.println(char(val)); Serial.write(50); } }
这是arduino的代码
import time, pyb from pyb import UART import ujson uart = UART(3, 9600) uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters def sending_data(): global uart uart.write('F') def recive_data(): global uart #data = uart.readchar() #print(data) if uart.any(): print("thatsgood") tmp_data = uart.readchar() uart.write("RECIVED : %s\n"%tmp_data) print(tmp_data) while(True): #sending_data() #time.sleep(1000) print("thatsgood") tmp_data = uart.readchar() #uart.write("RECIVED : %s\n"%tmp_data) #print(tmp_data) if uart.any(): print("thatsgood") tmp_data = uart.readchar() uart.write("RECIVED : %s\n"%tmp_data) print(tmp_data)
这是openmv的代码,arduino接收数据正常,但openmv接收不了,最多只能接受乱码-1
-
想问arduino如何跟openmv通讯?
arduino可以接收openmv发送的字符,但openmv接收不了arduino发的
用的是uart通讯,openmv不断发出-1