DaveCalaway / Tiny_Remote

Tiny remote with ATtiny85
MIT License
0 stars 0 forks source link

Attiny85 with tiny_IRremote.h sending but not receiving IR codes #1

Open upl1nk-v01d opened 3 years ago

upl1nk-v01d commented 3 years ago

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; } }

//dw(led, 100, 500);
if (results.value == 16716525) { //POWER
  digitalWrite(led, HIGH);
  irsend.sendNEC(0x40BF28D7, 32); t = 0x40BF28D7;
} else if (results.value == 16760895) { // HOME
  irsend.sendNEC(0x40BFD827, 32); t = 0x40BFD827;
} else if (results.value == 16769565) { // GOTO (SWITCH)
  if (sw == 1) {
    sw = 2;
    dw(led, 300, 100);
  } else {
    sw = 1;
    dw(led, 300, 1000);
  }
} else if (results.value == 4294967295) { 
  irsend.sendNEC(t, 32); 
}

irrecv.enableIRIn();

} }

upl1nk-v01d commented 3 years ago

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