计时器与Arduino Leonardo发生冲突

时间:2015-02-08 09:24:21

标签: timer arduino

我已经创建了一个基于Arduino Leonardo的四轴飞行器,我使用Servo.h库来控制电机输出。我现在正在安装一个便宜的RF Link套件作为第一次无线测试飞行的通信,并且我已经下载了VirtualWire库。它运行完美,但它使用与伺服库相同的计时器。

我发现的所有库都使用了timer1,而且我的能力似乎更改源代码以使用另一个计时器。我也不确定timer2有足够高的分辨率来处理通信(timer1是16bit,timer2是8bit)。

以前有人遇到过这个问题吗?任何人如何能够解决这个问题?

所有建议和提示表示赞赏!

1 个答案:

答案 0 :(得分:0)

我将接收器换成了Arduino UNO,并使用了ServoTimer2库 http://forum.arduino.cc/index.php?topic=21975.0

它不能直接开箱即用,所以你必须改变

extern "C" {
   // AVR LibC Includes
   #include <inttypes.h
   #include <avr/interrupt.h>
   #include <WConstants.h>
}

#include<Arduino.h>

这不是一个完美的解决方案,但它现在有效。

相关问题