arduino给openmv发信息,openmv接不到
-
这是arduino代码
#define PinA 2 //外部中断0
#define PinB 8 //编码器的OUTB信号连接到数字端口8unsigned long time1 = 0; // 时间标记
long count = 0;void setup()
{
pinMode(PinA, INPUT);
pinMode(PinB, INPUT);
attachInterrupt(0, Code, FALLING);//脉冲中断函数
Serial.begin (9600);
}void loop()
{
Serial.println (count);
}// 编码器计数中断子程序
void Code()
{
//为了不计入噪音干扰脉冲,
//当2次中断之间的时间大于5ms时,计一次有效计数
if ((millis() - time1) > 5)
{
//当编码器码盘的OUTA脉冲信号下跳沿每中断一次,
if ((digitalRead(PinA) == LOW) && (digitalRead(PinB) == HIGH))
{
count--;
}
else
{
count++;
}
}
time1 == millis();
}这是openmv代码
uart = UART(3, 115200, timeout_char=1000)while(True):
if uart.any():
a=uart.readline()
print(a)
#uart.write("Hello World!\r")
time.sleep(1000)
-
https://singtown.com/learn/50240/
先测试OpenMV的代码。