arduino-uno


Programming attiny45 chip and ir remote library


I'm using the IR Remote library with an attiny45 chip. The codes works fine with an Arduino but getting error message when uploading to attiny45 chip.
#include <IRremote.h>
int RECV_PIN = 2;
int led = 1;
int relay = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
irrecv.enableIRIn(); // Start the receiver
pinMode (led, OUTPUT);
pinMode (relay, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
switch (results.value) {
case 0xff02fd :
digitalWrite(led, HIGH);
digitalWrite(relay, LOW);
break;
case 0x1FC42BD :
digitalWrite(led, HIGH);
digitalWrite(relay, LOW);
break;
default :
digitalWrite(led, LOW);
digitalWrite(relay, HIGH);
break;
}
irrecv.resume(); // Receive the next value
}
}
When uploading, i'm getting the following error messages :
Arduino: 1.8.1 (Windows 7), Board: "ATtiny25/45/85, ATtiny45, Internal 8 MHz"
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:176:3: error: 'TCCR2A' was not declared in this scope
TCCR2A |= _BV(COM2B1); // Enable pin 3 PWM output
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:15,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:176:17: error: 'COM2B1' was not declared in this scope
TCCR2A |= _BV(COM2B1); // Enable pin 3 PWM output
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:188:3: error: 'TCCR2A' was not declared in this scope
TCCR2A &= ~(_BV(COM2B1)); // Disable pin 3 PWM output
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:15,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:188:19: error: 'COM2B1' was not declared in this scope
TCCR2A &= ~(_BV(COM2B1)); // Disable pin 3 PWM output
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:210:3: error: 'TIMSK2' was not declared in this scope
TIMSK2 &= ~_BV(TOIE2); //Timer2 Overflow Interrupt
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:15,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:210:18: error: 'TOIE2' was not declared in this scope
TIMSK2 &= ~_BV(TOIE2); //Timer2 Overflow Interrupt
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:228:3: error: 'TCCR2A' was not declared in this scope
TCCR2A = _BV(WGM20);
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:15,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:228:16: error: 'WGM20' was not declared in this scope
TCCR2A = _BV(WGM20);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:229:3: error: 'TCCR2B' was not declared in this scope
TCCR2B = _BV(WGM22) | _BV(CS20);
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:15,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:229:16: error: 'WGM22' was not declared in this scope
TCCR2B = _BV(WGM22) | _BV(CS20);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:229:29: error: 'CS20' was not declared in this scope
TCCR2B = _BV(WGM22) | _BV(CS20);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:232:3: error: 'OCR2A' was not declared in this scope
OCR2A = SYSCLOCK / 2 / khz / 1000;
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:233:3: error: 'OCR2B' was not declared in this scope
OCR2B = OCR2A / 3; // 33% duty cycle
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:262:3: error: 'TCCR2A' was not declared in this scope
TCCR2A = 0; // normal mode
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:15,
from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:267:7: error: 'TCCR2B' was not declared in this scope
cbi(TCCR2B,CS22);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:267:3: note: in expansion of macro 'cbi'
cbi(TCCR2B,CS22);
^
Multiple libraries were found for "IRremote.h"
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:267:14: error: 'CS22' was not declared in this scope
Used: C:\Users\Acer\Documents\Arduino\libraries\IRremote
cbi(TCCR2B,CS22);
Not used: C:\Users\Acer\Documents\Arduino\libraries\IRremote1
^
Not used: C:\Users\Acer\Documents\Arduino\libraries\Arduino-IRremote-master
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:267:3: note: in expansion of macro 'cbi'
cbi(TCCR2B,CS22);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:268:14: error: 'CS21' was not declared in this scope
sbi(TCCR2B,CS21);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:268:3: note: in expansion of macro 'sbi'
sbi(TCCR2B,CS21);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:269:14: error: 'CS20' was not declared in this scope
cbi(TCCR2B,CS20);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:269:3: note: in expansion of macro 'cbi'
cbi(TCCR2B,CS20);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:272:7: error: 'TIMSK2' was not declared in this scope
sbi(TIMSK2,TOIE2);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:272:3: note: in expansion of macro 'sbi'
sbi(TIMSK2,TOIE2);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:272:14: error: 'TOIE2' was not declared in this scope
sbi(TIMSK2,TOIE2);
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:272:3: note: in expansion of macro 'sbi'
sbi(TIMSK2,TOIE2);
^
In file included from C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:13:0:
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:46:24: error: 'TCNT2' was not declared in this scope
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT2
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:278:3: note: in expansion of macro 'RESET_TIMER2'
RESET_TIMER2;
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp: In function 'void __vector_5()':
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremoteInt.h:46:24: error: 'TCNT2' was not declared in this scope
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT2
^
C:\Users\Acer\Documents\Arduino\libraries\IRremote\IRremote.cpp:308:3: note: in expansion of macro 'RESET_TIMER2'
RESET_TIMER2;
^
exit status 1
Error compiling for board ATtiny25/45/85.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This is the version of Arduino that i'm using :
Arduino: 1.8.1 (Windows 7), Board: "ATtiny25/45/85, ATtiny45, Internal 8 MHz"
I am pretty sure this has problem has to be the fact when downloading to an attiny45 or any Arduino-like-chip you need to reset the chip as code is being downloaded. The reset pin is pin 1. To reset it you should ground the pin. Here is the pinout diagram for reference.

Related Links

Sparkfun CAN BUS sheild with arduino UNO
Using Arduino and Motor Shield
AT+CSQ? returns error
Array accessing in arduino and for loop
Bluetooth module won't function when working with leapmotion
switch on or off the motor based on the reply of the user
IS my Modulo usage incorrect? What can
Use analog output as digital in relay pins
Arduino Uno and ESP8266-01
Power supply for raspberry and arduino
Arduino UNO and MPU 6050
Understanding timer choices/options
Programming attiny45 chip and ir remote library
Arduino Uno: Running multiple servos
MPU 6050 SD Writing Frequency Arduino is not constant , how to have a constant writing frequency?
MPU 6050 giving values -1

Categories

HOME
winforms
coq
activiti
kde
relay
programming-languages
malloc
constraint-programming
adfs
slurm
spring-xd
quickbooks
windows-phone-7
try-catch
iolanguage
lombok
libtiff
highlight.js
google-static-maps
undefined
beyondcompare
shared-hosting
plunker
swiftlint
autoconf
opencover
php-openssl
django-storage
url-scheme
opentype
frame
google-sites-2016
copying
winrt-xaml-toolkit
typed.js
openoffice.org
language-concepts
stacked
dartium
jquery-bootgrid
event-driven
service-discovery
splice
bootstrapper
janrain
nomethoderror
vao
unixodbc
slick-3.0
qcombobox
scorm
outlook-2013
xml-documentation
termination
pubmed
datastax-startup
alphabet
sage-one
mplayer
jxcore
tactic
feeds
sybase-asa
windows-iot-core-10
cudafy.net
background-service
vmware-tools
transmitfile
google-web-starter-kit
ctest
django-debug-toolbar
clang-static-analyzer
master-slave
fadeout
dataview
bluegiga
ios8-today-widget
icu4j
purge
ionic
php-ci
nsight
umbraco6
formatjs
pick
codeigniter-routing
titanium-modules
starcluster
braille
dealloc
multiprocessor
page-layout
oam
quartz-graphics
dbconnection
bulkloader
jplaton
chronoforms
type-equivalence
cassini-dev
wsdl-2.0
factory-method
mhtml
funscript
pysimplesoap
cascalog
twrequest
errai
viewswitcher
jspinclude
onsubmit
jquery-ui-layout
gnustep
noscript
thread-local-storage
genealogy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App