Arduino Attiny 85 IR library compiler error - Page 1
Forum section: electronics / general

author: FlevasGR
author_rank: Regular Contributor
timestamp: May 04, 2015, 08:58:40 pm
content: I'm about to ask a question for the most common problem which everyone has withattiny85and the IR library. I will try to make this question as simple as possible.Few things about the lib and the chipFirst of all the libhttps://github.com/shirriff/Arduino-IRremoteworks great on the UNO and it's the best out there.TheAttiny85is the smallest chip you can get able to run Arduino code. It has alot of limitations but it worth it!The common problemAttiny85uses different timers from the normal Attiny and Atmega chips which makes it impossible to run the standard libraries. There are some fixes for some libs. For example the IR Remote has a version which **ALMOST** works with the chip and it can be found over here:http://gammon.com.au/Arduino/IRremote_Attiny.zipHowever the problem lies in the core. The first time i used the patched IR i had theMIT High-Low Media Groupversion 1 of the core files which bearly worked but it was the first released so...After reading this guide:http://www.instructables.com/id/Attiny-IR-library/?ALLSTEPS I used an updated core which can be found here:https://arduino-tiny.googlecode.com/files/arduino-tiny-0100-0017.zipAnd the final problemEven with the updated core i still got *only 1* last error.Code:Compiling 'Shit' for 'ATtiny85 @ 8 MHz (internal oscillator; BOD disabled)'IRremoteInt.h:101: error: 'RAWBUF' was not declared in this scopeError compilingDoes anyone know how to fix it?LinksMIT high-low group first version:http://highlowtech.org/?p=1229Tutorial for the chip and the IR:http://www.instructables.com/id/Attiny-IR-library/?ALLSTEPSThe IR original lib:https://github.com/shirriff/Arduino-IRremoteUpdated core:https://arduino-tiny.googlecode.com/files/arduino-tiny-0100-0017.zipJust in case you wanna know i'm using the Atmel Studio 6 with the Visual Micro plugin instead of the crappy-arduino-IDE

author: linux-works
author_rank: Super Contributor
timestamp: May 04, 2015, 09:12:41 pm
content: fastest thing: just recusive grep for that in the include tree area.I was never able to get ken's libr to work on the 85 but it would be nice. I do have a working ir receive on an 85 (receives ir and sends codes over uart to my 'main' arduino) but its nowhere near as good or robust as ken's.ken's assumed stuff that was on the atmega but its not the most portable code (not his fault, though).

author: FlevasGR
author_rank: Regular Contributor
timestamp: May 04, 2015, 09:47:09 pm
content: Quote from: linux-works on May 04, 2015, 09:12:41 pmI fixed the problem above just by swaping #include <IRremote.h> and #include <IRremoteInt.h>however now the receiver is just now working. Nothing happens when im pressing the button on my remote control. Is that what happened to you?

author: linux-works
author_rank: Super Contributor
timestamp: May 04, 2015, 09:53:38 pm
content: I was not aware there was a -buildable- ken s. based 85 library for ir.or, maybe its the one where you decide which protos (rc5, sony, nec) you want, since you can't fit them all in?you should not include 'int'. its an 'internal' (hidden from you) interface. if you include that, you are doing it the wrong way.did your grep -r find which file that symbol is in?

author: FlevasGR
author_rank: Regular Contributor
timestamp: May 04, 2015, 10:00:57 pm
content: I removed it but nothing happens again.Here is my code in case you wanna see itCode:#include <IRremote.h>int tip_pin = 3;boolean tip_state = 0x0;int IRpin = 4;IRrecv irrecv(IRpin);decode_results results;void setup(){irrecv.enableIRIn();pinMode(tip_pin, OUTPUT);pinMode(IRpin, INPUT);}void loop(){if (irrecv.decode(&results)){if (results.value == 2672){tip_state = !tip_state;digitalWrite(tip_pin, tip_state);}irrecv.resume(); // Receive the next value}}Do i need to put the IR pin in PWM-capable pin?

author: linux-works
author_rank: Super Contributor
timestamp: May 05, 2015, 12:35:49 am
content: you are not doing pwm (pwm is an output concept; you are doing a pulse-in, probably) so you don't need pwm pins.if you are not attached to THAT library, then there are others that do work for the at85.try this one:https://learn.adafruit.com/trinket-gemma-ir-remote-control/overviewI had to modify that, but at least it built, it runs and I'm using it to pick up some rc5 (I think) remote codes. does not work on sony (even though it says it does) but it does at least run for some ir protocols.

author: FlevasGR
author_rank: Regular Contributor
timestamp: May 05, 2015, 03:49:44 am
content: I'm using a Sony remote :/ seems like attiny85 is a nice piece of junk. You know what is worst? People on YouTube who have the library working and they're not having a sketch link or instructions.Anyway since the IR receiver reads a pulse from the remote control is it possible to use the pulsein() function? Sure it's working on the attiny85 as high-low says on their website.

author: linux-works
author_rank: Super Contributor
timestamp: May 05, 2015, 03:53:22 am
content: I also tried with some success on an attiny84 and 4314, but the 85 is the sweet spot for its size.I'll post a link to my code. it was mostly based on the adafruit gemma which is her 85 board, I think.its a fine chip. 8k of flash! 8mhz with no xtal. but timers and things vary from chip to chip and embedded programs are usually not portable because its so hardware low-level.PM me and I'll send you the 85 code that works for me. I'm using 1.5.8 IDE with the 'standard' tiny cores (the most common one, I forget its name).

author: FlevasGR
author_rank: Regular Contributor
timestamp: May 05, 2015, 04:25:32 am
content: Yeah it's nice chip because for the fan remote control project I use only 4 pins and pretty much I'm not wasting pins. I bought many attiny chips mostly because I want to have a variety of tools to work with.

author: FlevasGR
author_rank: Regular Contributor
timestamp: May 05, 2015, 12:11:44 pm
content: I tried this code which is the simplest possible code just for Sony and its not working...Code:int irPin = 4;int tipPin = 3;int start_bit = 2200; //Start bit threshold (Microseconds)int bin_1 = 1000; //Binary 1 threshold (Microseconds)int bin_0 = 400; //Binary 0 threshold (Microseconds)boolean state = 0x0;void setup() {pinMode(tipPin, OUTPUT);pinMode(irPin, INPUT);//Serial.begin(9600);//Serial.println("IR/Serial Initialized: ");}void loop() {int key = getIRKey(); //Fetch the key//Serial.println(key);if (key != 0) {state != state;digitalWrite(tipPin, state);}delay(400); // avoid double key logging (adjustable)}int getIRKey() {int data;int i;while(pulseIn(irPin, LOW) < start_bit); //Wait for a start bitfor(i = 0 ; i < 11 ; i++)data = pulseIn(irPin, LOW); //Start measuring bits, I only want low pulsesfor(i = 0 ; i < 11 ; i++) //Parse them{if(data > bin_1) //is it a 1?data = 1;else if(data > bin_0) //is it a 0?data = 0;elsereturn -1; //Flag the data as invalid; I don't know what it is! Return -1 on invalid data}int result = 0;for(i = 0 ; i < 11 ; i++) //Convert data bits to integerif(data == 1) result |= (1<<i);return result; //Return key number}What the hell is wrong with this

author: linux-works
author_rank: Super Contributor
timestamp: May 06, 2015, 01:39:00 pm
content: Code:if (key != 0) {state != state;you didn't mean that 2nd line, did you? that's a pretty useless line of codemaybe you meant:state = (~state);remember, one is bitwise and other is conditional.

author: senso
author_rank: Frequent Contributor
timestamp: May 06, 2015, 02:43:04 pm
content: What sensor are you using the detect the IR signal?