一乐电子

一乐电子百科

 找回密码
 请使用微信账号登录和注册会员

QQ登录

只需一步,快速开始

快捷登录

手机号码,快捷登录

搜索
查看: 2221|回复: 1
收起左侧

[arduino] Arduino-zion 使用IRremote库时,编译失败。

[复制链接]
发表于 2014-11-10 21:44 | 显示全部楼层 |阅读模式
近期在学习 Arduino 技术,想做一个红外接受/发射的DEMO , 用的是在论坛里购买的 Arduino-zion ATmega128 16M

按照网上的一些教程,调用了IRremote库来编写,但是在编译时,总是出现错误。
C:\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\Arduino\libraries\IRremote\IRremote.cpp:254: error: 'TCCR2A' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:254: error: 'COM2B1' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\Arduino\libraries\IRremote\IRremote.cpp:262: error: 'TCCR2A' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:262: error: 'COM2B1' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\Arduino\libraries\IRremote\IRremote.cpp:280: error: 'TIMSK2' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:290: error: 'TCCR2A' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:290: error: 'TCCR2B' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:290: error: 'WGM22' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:290: error: 'OCR2A' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:290: error: 'OCR2B' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\Arduino\libraries\IRremote\IRremote.cpp:306: error: 'TCCR2A' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:306: error: 'TCCR2B' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:306: error: 'OCR2A' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:309: error: 'TIMSK2' was not declared in this scope
C:\Arduino\libraries\IRremote\IRremote.cpp:309: error: 'OCIE2A' was not declared in this scope




但是,如果选择其他的版卡来编译的话(例如 ATmega328),就可以编译成功。


请问有没有其他办法可以实现读取和发射红外呢? 在哪里有教程?
发表于 2014-11-10 22:42 | 显示全部楼层
定时器要改,看128数据手册

本版积分规则

QQ|一淘宝店|手机版|商店|电子DIY套件|一乐电子 ( 粤ICP备09076165号 ) 公安备案粤公网安备 44522102000183号

GMT+8, 2024-5-10 22:15 , Processed in 0.062575 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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