【问题标题】:Arduino IR Led not workingArduino IR LED 不工作
【发布时间】:2016-04-01 01:59:53
【问题描述】:

我需要有关此问题的主要故障排除帮助,我提前感谢任何人。这是一个小 Arduino 草图,它应该通过红外 LED 向我的索尼相机发送红外脉冲,以触发快门并拍照。我最终计划将它与一个射频发射器连接起来,这样我就可以从远处拍摄野生动物的照片。 问题是这段代码在过去运行良好,带有运动传感器和延时应用程序,如http://multifunctionremote.blogspot.com/ 所述。 我不能让它工作了。从某种意义上说,RF 代码和电路完美地工作,我让一个 Arduino 命令另一个 Arduino 来闪烁 LED,所以你不需要为此烦恼。我只是无法再让红外 LED 激活相机。我正在使用的代码在此末尾。该电路非常简单:一个 IR LED 连接到引脚 8,并通过一个 220 欧姆电阻接地。看在上帝的份上,它不起作用,我不知道为什么。这是我所做的故障排除:

-检查相机:它与本地品牌红外遥控器完美配合,所以这不是问题 -我已经切换了 3 个不同的 IR LED,以确保我没有处理有缺陷的 LED。我通过使用较低的欧姆电阻 100 欧姆来最大化输出。无论如何,我很难检查 LED,因为您看不到它们闪烁,但我认为我无法获得 3 个有缺陷的 LED! -电路正在工作,因为当我使用红色 LED 而不是 IR LED 时,它会闪烁。它是否以正确的频率闪烁?我不能说。 - Arduino 有缺陷吗?我检查了所有引脚,它们工作并在两个不同的控制器上测试了电路,但无济于事。 自两年前一切正常以来,唯一改变的是我正在使用的 Arduino IDE 版本。无论如何,这是否改变了控制器上的固件,因此该代码不再起作用?

int IRledPin =  8;
void setup() {
pinMode(IRledPin,OUTPUT);
}

void loop() {
SendChannelUpCode();
delay(3000);
}
void pulseIR(long microsecs) {
   // This is the function dealing with the impulse frequency: we'll count     down from the number of microseconds we are told to wait

  cli();  // this turns off any background interrupts

  while (microsecs > 0) {
   // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IRledPin, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(9);         // hang out for 10 microseconds
   digitalWrite(IRledPin, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(9);         // hang out for 10 microseconds

   // so 26 microseconds altogether
   microsecs -= 26;
  }

  sei();  // this turns them back on
  }
 void SendChannelUpCode() {

// 这是索尼 NEX-7 快门释放的代码 脉冲红外(2400); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(11000); 脉冲红外(2400); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(600); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(600); 脉冲红外(1200); 延迟微秒(11000); }

【问题讨论】:

  • 阅读量太大了,IMO 太多了。修剪它并形成段落......

标签: arduino infrared


【解决方案1】:

我会检查以确保 delaymicroseconds()(仍然)在中断关闭的情况下正常工作。除此之外,我看不到任何可能发生重大变化的事情。

要获得有关红外 LED 的视觉反馈,您可以将第二个 LED 与其串联并减小电阻值。要实际检查 IR LED,我想您可以将其指向与 LED 和电阻器串联的 IR 光电晶体管。

要检查频率,请将 LED 替换为红色 LED(或将其串联一个,如上所述)并测量脉冲 IR(1000000) 的脉冲需要多长时间。

我现在想不出别的了,除非你有示波器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多