mega板和openmv通信例程
- openmv
import time
from pyb import UART
uart = UART(3,9600) # 注意波特率
while(True):
uart.write("123"+"\n")
time.sleep_ms(1000)
a = uart.read()
print(a)
- mega板
void setup(){
Serial.begin(115200);
Serial.write("qr\n");
// Serial.write("color\n");
//Serial.write("close\n");
delay(1000);
}
String serial_data = "";
void loop(){
if(Serial.available()){
serial_data = Serial.readStringUntil('\n'); // 读取消息
Serial.println(serial_data); // 发送消息
}
}
标签:mega,例程,write,Serial,serial,openmv
From: https://www.cnblogs.com/hnu-hua/p/16863355.html