openmv 与 arduino 第一次 通信成功
几个笔记

mv代码
import sensor, image, time
import json
from pyb import UART

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # use RGB565.
sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
sensor.skip_frames(10) # Let new settings take affect.
sensor.set_auto_whitebal(False) # turn this off.
clock = time.clock() # Tracks FPS.

uart = UART(3, 9600)

while(True):
clock.tick() # Track elapsed milliseconds between snapshots().
img = sensor.snapshot() # Take a picture and return the image.
img.lens_corr(1.5)
for code in img.find_qrcodes():
message = code.payload()
uart.write(message)
print(code)
else:
print(“not found!”)
openmv 与arduino 第一次通信
arduino代码

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11);//RX=2,TX=3

void setup()
{

//硬件串口波特率
Serial.begin(9600);
//软件串口波特率
mySerial.begin(9600);
pinMode(7, OUTPUT);
}
void loop()
{

//如果硬件串口有数据
if(Serial.available())
{
//从硬件串口读出一字节,写入软件串口
mySerial.write(Serial.read());

if(Serial.read()==123)
{
digitalWrite(7, HIGH);
}
}
//如果软件串口有数据
if(mySerial.available())
{
//从软件串口读出一字节,写入硬件串口
Serial.write(mySerial.read());
}

}

相关文章:

  • 2021-10-12
  • 2022-01-10
  • 2021-08-14
  • 2021-07-30
  • 2021-11-10
  • 2022-02-11
  • 2021-07-11
  • 2022-02-02
猜你喜欢
  • 2021-09-11
  • 2022-12-23
  • 2022-01-01
  • 2021-11-19
  • 2021-06-03
  • 2022-01-10
相关资源
相似解决方案