Hello, I have spent 10 hours trying to get an IR receiver to work on my ATtiny84. I have tried three libraries (IRLremote, IRsmallDecoder, IRremote (too large for my project), and can't switch on an LED (base case).
Basic information:
1: All code works on Arduino Uno- so the code is not the issue (necessarily). It compiles on ATtiny84.
2: I can get other code to run on the ATtiny using Arduino as ISP- so it is not a chip problem.
3: I can't debug using serial, despite hours trying to figure out how to print serial output and watching videos. Instead, I chose to switch on an LED.
4: I have tried to map EVERY pin to IR receiver- no luck
Below is my code that for two attempts. I am desperate at this point- I have tried everything.
// IRLremote EXAMPLE
// include PinChangeInterrupt library* BEFORE IRLremote to acces more pins if needed
#include "PinChangeInterrupt.h"
#include "IRLremote.h"
// Choose a valid PinInterrupt or PinChangeInterrupt* pin of your Arduino board
#define pinIR 2
// Choose the IR protocol of your remote. See the other example for this.
CNec IRLremote;
void setup()
{ pinMode(1, OUTPUT);
// Start reading the remote. PinInterrupt or PinChangeInterrupt* will automatically be selected
if (!IRLremote.begin(pinIR)){
}
}
void loop()
{
if (IRLremote.available())
{
digitalWrite(1, HIGH);
delay(500);
digitalWrite(1, LOW);
delay(500);
auto data = IRLremote.read();
}
}
Below is my code for IRsmallDecoder
#define IR_SMALLD_NEC //1st: define which protocol to use:
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(1); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;
void setup() {
pinMode(1, OUTPUT);
}
void loop() {
if (irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
digitalWrite(1, HIGH);
delay(500);
digitalWrite(1, LOW);
delay(500);
}
}
If anyone has any functional code for ATtiny84 that they can share, I would be grateful. I need code that take up less memory than IRremote.
THANKS!