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

Arduino UNO(9600) with Wizfi250 cannot send data to Ubidots
How to wire a 12V double solenoid to an Arduino?
Receiving data automatically in wifi(ESP8266) Even though connected my mobile with ESP8266
How to copy string (char*) from Flash to RAM with strcpy_P
LED's won't light up with Arduino
Every function executes on Arduino reset
What is the output of this arduino code?
Shield L6474 and motor equiped with a reducer
NRF24L01+PA+LNA (Transciever) not communicating between two arduinos
Can't program Arduino 328P after first time use of ICSP Sparkfun AVR Pocket Programmer
Arduino uploading issue: “avrdude: no programmer has been specified on the command line or the config file”
Code is showing multiple object declaration error during multiple file compilation
arduino wifi upload google spreadsheet
How to solve error compiling an arduino sketch?
load image in the TFT lcd screen without SD card
how to send dummy data on gpio pins of arduino uno.?

Categories

HOME
sendgrid
testing
listview
isabelle
appx
stock
android-4.4-kitkat
cvs
jira
razor
maven-3
sharepoint-designer
autotools
node-notifier
pheatmap
google-translate
numeral.js
nstableview
n-gram
hex-editors
pc
jsdoc
google-static-maps
http-status-code-504
sms-gateway
scichart
autocad-plugin
orleans
facebook-instant-articles
android-widget
kannel
user-interaction
spring-mybatis
xacml
delicious-api
nameservers
phonegap
fog
android-nestedscrollview
mapdb
devextreme
mixture-model
service-discovery
temporary-files
g-code
grid.mvc
reportingservices-2005
vao
total-commander
btrace
dotcover
smartcontracts
zip4j
errordocument
jquery-validate
fancybox-2
jxcore
sonarlint-vs
smart-table
pycaffe
cubes
word-vba-mac
abcpdf9
angular-cache
trash
paypal-express
blackberry-10
hover-over
goose
revolution-r
spim
varargs
sframe
emailrelay
cakephp-3.1
ami
skos
truevault
tween
knuth
cdt
android-nested-fragment
android-imagebutton
client-side-templating
html-helper
castle
rebol3
hippomocks
marmalade
mechanize-ruby
page-layout
.aspxauth
opcache
cos
flashvars
anonymous-methods
sublist
onsubmit
postgresql-performance
code-cleanup
celltable
dbal
user-friendly
backcolor

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App