Forum: Mikrocontroller und Digitale Elektronik Arduino IRSend NEC Codes


von Timo H. (eifelbiker)


Lesenswert?

Hallo Leute,

ich habe einen mobilen DVD Player von MEDION der sich zum Teil nur über 
Fernbedienung bedienen lässt. Leider ist die FB nicht mehr aufzufinden. 
Mit Hilfe von IRMP habe ich rausgefunden das der Player auf NEC Codes 
reagiert.

Hat irgendwer ein Arduino Script das alle NEC Codes in einer Schleife 
durch geht? Oder kann mir irgendwer einen Hinweis geben wie ich das ran 
gehe. Das wäre super. Vielen Dank.

von Frank M. (ukw) (Moderator) Benutzerseite


Lesenswert?

Timo H. schrieb:

> Mit Hilfe von IRMP habe ich rausgefunden das der Player auf NEC Codes
> reagiert.

Auf einem Arduino? Wenn, dann weisst Du ja auch die Geräte-Adresse. Nun 
musst Du nur noch die 256 dazu passenden möglichen Kommando-Codes 
durchgehen.

von Timo H. (eifelbiker)


Lesenswert?

ich habe den folgenden Code verwendet:
1
#include <IRremote.h>
2
3
int RECV_PIN = 11;
4
5
IRrecv irrecv(RECV_PIN);
6
7
decode_results results;
8
9
void setup()
10
{
11
  Serial.begin(9600);
12
  irrecv.enableIRIn(); // Start the receiver
13
}
14
15
// Dumps out the decode_results structure.
16
// Call this after IRrecv::decode()
17
// void * to work around compiler issue
18
//void dump(void *v) {
19
//  decode_results *results = (decode_results *)v
20
void dump(decode_results *results) {
21
  int count = results->rawlen;
22
  if (results->decode_type == UNKNOWN) {
23
    Serial.print("Unknown encoding: ");
24
  }
25
  else if (results->decode_type == NEC) {
26
    Serial.print("Decoded NEC: ");
27
  }
28
  else if (results->decode_type == SONY) {
29
    Serial.print("Decoded SONY: ");
30
  }
31
  else if (results->decode_type == RC5) {
32
    Serial.print("Decoded RC5: ");
33
  }
34
  else if (results->decode_type == RC6) {
35
    Serial.print("Decoded RC6: ");
36
  }
37
  else if (results->decode_type == PANASONIC) {
38
    Serial.print("Decoded PANASONIC - Address: ");
39
    Serial.print(results->panasonicAddress,HEX);
40
    Serial.print(" Value: ");
41
  }
42
  else if (results->decode_type == JVC) {
43
    Serial.print("Decoded JVC: ");
44
  }
45
  Serial.print(results->value, HEX);
46
  Serial.print(" (");
47
  Serial.print(results->bits, DEC);
48
  Serial.println(" bits)");
49
  Serial.print("Raw (");
50
  Serial.print(count, DEC);
51
  Serial.print("): ");
52
53
  for (int i = 0; i < count; i++) {
54
    if ((i % 2) == 1) {
55
      Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
56
    }
57
    else {
58
      Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
59
    }
60
    Serial.print(" ");
61
  }
62
  Serial.println("");
63
}
64
65
66
void loop() {
67
  if (irrecv.decode(&results)) {
68
    Serial.println(results.value, HEX);
69
    dump(&results);
70
    irrecv.resume(); // Receive the next value
71
  }
72
}

und erhalte folgende Ergebnisse:

Decoded NEC: FFA25D (32 bits)
Raw (68): -16188 9100 -4400 600 -500 650 -500 600 -500 650 -500 550 -550 
600 -500 650 -500 600 -500 600 -1650 600 -1600 650 -1600 600 -1650 600 
-1600 650 -1600 600 -1650 550 -1650 650 -1600 600 -500 650 -1600 600 
-500 650 -500 550 -550 600 -1650 600 -500 600 -500 650 -1600 600 -500 
650 -1600 600 -1650 600 -1600 650 -500 600 -1600 650

von Frank M. (ukw) (Moderator) Benutzerseite


Lesenswert?

Sorry, Dein Code hat nichts mit IRMP zu tun. Daher kann ich Dir 
nicht weiterhelfen.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.