极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9614|回复: 2

Leonardo(ATMega32u4)+IRemote,红外管接哪个Arduino管脚

[复制链接]
发表于 2014-7-6 19:10:59 | 显示全部楼层 |阅读模式
本帖最后由 小若 于 2014-7-7 08:55 编辑

如标题,参考IRemote代码,将红外发射管正极接在PIN10,无法发射。
接在PIN3,也没有反应。 大家有什么建议吗?

看过 幻生幻灭的 红外发射的帖子,他的那个基于Leonardo的例子,貌似直接连接在PIN3口。
不知有没有改IRemote的TIMER配置

// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  //#define IR_USE_TIMER1   // tx = pin 11
  #define IR_USE_TIMER2     // tx = pin 9
  //#define IR_USE_TIMER3   // tx = pin 5
  //#define IR_USE_TIMER4   // tx = pin 6
  //#define IR_USE_TIMER5   // tx = pin 46

// Teensy 1.0
#elif defined(__AVR_AT90USB162__)
  #define IR_USE_TIMER1     // tx = pin 17

// Teensy 2.0
#elif defined(__AVR_ATmega32U4__)
  //#define IR_USE_TIMER1   // tx = pin 14
  //#define IR_USE_TIMER3   // tx = pin 9
  #define IR_USE_TIMER4_HS  // tx = pin 10

// Teensy 3.0
#elif defined(__MK20DX128__)
  #define IR_USE_TIMER_CMT  // tx = pin 5

// Teensy++ 1.0 & 2.0
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
  //#define IR_USE_TIMER1   // tx = pin 25
  #define IR_USE_TIMER2     // tx = pin 1
  //#define IR_USE_TIMER3   // tx = pin 16

// Sanguino
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__)
  //#define IR_USE_TIMER1   // tx = pin 13
  #define IR_USE_TIMER2     // tx = pin 14

// Atmega8
#elif defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__)
  #define IR_USE_TIMER1   // tx = pin 9

// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, etc
#else
  //#define IR_USE_TIMER1   // tx = pin 9
  #define IR_USE_TIMER2     // tx = pin 3
#endif
回复

使用道具 举报

 楼主| 发表于 2014-7-7 08:54:26 | 显示全部楼层
自问自答,跟大家共享一下
http://forum.arduino.cc/index.php?topic=122013.0
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-6 15:34 , Processed in 0.036484 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表