Hello!
I'm struggling to find a way to make ATTiny85 receive IR code signals.
About half year ago I managed to receive and send IR codes.
Cannot find out what is changed in library code in this period of time.
BTW, the green LED should switch on when remote POWER button is pressed.
Please help.
hi, again!
I made some progress :)
One thing... How to get IR code values? Don't know why results.value is giving 0 value.
Please see picture in link below.
http://v01d.rf.gd/info/tiny_remote/IR_RX_issue.png
Hello! I'm struggling to find a way to make ATTiny85 receive IR code signals. About half year ago I managed to receive and send IR codes. Cannot find out what is changed in library code in this period of time. BTW, the green LED should switch on when remote POWER button is pressed. Please help.
video: https://youtu.be/Cw458wy-gMw
here is my demo code:
/ rm media remote 16716525 0xFF12ED POWER ON/OFF /
include "tiny_IRremote.h"
include <avr/wdt.h>
int sw = 1; int osd_sw = 1; int rx = 3; int tx = 4; int c=0; IRrecv irrecv(rx); IRsend irsend; decode_results results;
const int spk = 1; const int led = 0; const int led2 = 2; long t = 0;
void setup() { //wdt_disable(); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(spk, OUTPUT); pinMode(tx, OUTPUT); pinMode(rx, INPUT); irrecv.enableIRIn(); }
void dw(int p, int d, int t = 0) { if (t>0) { tone(spk, t, d);} digitalWrite(p, HIGH); delay(d); digitalWrite(p, LOW); }
void loop() { delay(10); if (irrecv.decode(&results)) { irrecv.resume(); if (sw == 1) { dw(led2, 200, 1000); if (results.value == 16720605) { // LEFT irsend.sendNEC(0x40BF8877, 32); t = 0x40BF8877; } else if (results.value == 16763445) { // RIGHT irsend.sendNEC(0x40BF08F7, 32); t = 0x40BF08F7; } } else if (sw == 2) { dw(led2, 200, 100); if (results.value == 16763445) { // FORWARD irsend.sendNEC(0x40BF55AA, 32); t = 0x40BF55AA; } else if (results.value == 16720605) { // REWIND irsend.sendNEC(0x40BF27D8, 32); t = 0x40BF27D8; } else if (results.value == 16736415) { // OSD/MENU BAR if (osd_sw == 1) { osd_sw = 2; irsend.sendNEC(0x40BFE31C, 32); } else { osd_sw = 1; irsend.sendNEC(0x40BFC837, 32); } } else if (results.value == 16760895) { // RETURN irsend.sendNEC(0x40BF58A7, 32); t = 0x40BF58A7; } }
} }