本帖最后由 O_o 于 2013-3-18 13:14 编辑
变成无限累加 时间了 要控制 必须 记录每个通道的时间。
每通道信号间隔260μm 20ms 更新一次
- int PPM = 2;
- unsigned long asshoeltime;
- unsigned long asshoeltime2;
- void setup()
- {
- Serial.begin(9600);
- pinMode(PPM, INPUT);
- attachInterrupt(0, fuck1, RISING);
- attachInterrupt(0, fuck2, FALLING);
- }
- void fuck1()
- {
- asshoeltime = micros();
- }
- void fuck2()
- {
- asshoeltime2 = micros() - asshoeltime;
-
- }
- void loop() {
- Serial.print(" ");
- Serial.print(asshoeltime2);
- }
复制代码 |