Serial.println(results.value, HEX);
blepharocyte a écrit:Oui sa serais cool !!
J'ai trouvé un code sur internet qui permet de récupérer des valeurs après réception d'un signal mais j'avoue ne pas comprendre le retour de l'arduino. C'est du genre: signal raw: 9344 1150 -550 100 -50 50 -200 100 -200 50 -100 50 -100 50 -100 50 -50 100 -200 50 -250 50 -200 100 -50 50 -200 100 -50 100 -200 50 -250 50 -50 100 -200 50 -100
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen;
int ESPACE;
int COMPTE;
int START;
ESPACE = 0;
COMPTE = 0;
START = 0;
for (int i = 1; i < count; i++) {
if ((i % 2) == 1) {
if (START == 0) { if (results->rawbuf[i] > 50) {START = i; Serial.print(results->rawbuf[i], DEC);}; } else
{Serial.print(results->rawbuf[i], DEC);}
}
else {
if (START != 0) {
Serial.print(-(int)results->rawbuf[i], DEC);
ESPACE = ESPACE + results->rawbuf[i];
COMPTE++; }
}
if (START != 0) {Serial.print(" ");}
}
Serial.println("");
DEC);
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume(); // Receive the next value
}
}
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
unsigned long CODE = 0;
unsigned long LISTE_CODE [35] = { // Code binaire de chaque touche
2708389951,
2708344051,
2708387911,
2708355271,
2708359351,
2708346091,
2708342011,
2708382811,
2708396071,
2708399131,
2708374651,
2708350171,
2708347621,
2708354251,
2708395051,
2708362411,
2708376691,
2708352211,
2708368531,
2708384851,
2708360371,
2708357311,
2708373631,
2708340991,
2708380771,
2708343541,
2708400151,
2708343031,
2708393011,
2708349151,
2708381791,
2708384341,
2708398111,
2708396581,
2708370571};
int POS[35] = { // position de chaque touche: ij = i-ème ligne, j-ième colonne
11,
12,
13,
14,
21,
22,
23,
24,
31,
32,
33,
34,
41,
42,
43,
44,
51,
52,
53,
54,
61,
62,
63,
64,
71,
72,
73,
74,
81,
82,
83,
84,
91,
92,
93};
char* MESSAGE[36] = { // Enoncé en clair de la touche
"START/STOP",
"PHOTO",
"ZOOM W",
"ZOOM T",
"SELF T",
"D.EFFECTS",
"^",
"MENU",
"TV SCREEN",
"ON/OFF",
"v",
"SET",
"INDEX",
"SLIDE SHOW",
"CARD -",
"CARD +",
"DATA CODE",
"SEARCH SELECT",
"|<<",
">>|",
"ZERO SET MEMORY",
"REW<<",
"PLAY>",
"FF>>",
"12bit AUDIO OUT",
"-/<||",
"STOP#",
"+/||>",
"AUDIO DUB.",
"PAUSE||",
"SLOW|>",
"x2",
"REC PAUSE",
"AV INSERT",
"AV<->DV"
};
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen -1;
int ESPACE;
int COMPTE;
int START;
ESPACE = 0;
COMPTE = 0;
START = 0;
CODE = 0;
for (int i = 1; i < count; i++)
{ if ((i % 2) == 1)
{ if (START == 0)
{ if (results->rawbuf[i] > 80)
{ START = i; };
}
else
{ if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ // Serial.print("0");
CODE=CODE<<1;}
else
{ if ( (results->rawbuf[i] < 35) and (results->rawbuf[i] > 29) )
{ // Serial.print("1");
CODE=CODE<<1; CODE++;}
else
{
Serial.print("+"); Serial.print(results->rawbuf[i], DEC); Serial.print("+");
}
}
}
}
else
{ if (START != 0)
{ if ( (results->rawbuf[i] < 16) and (results->rawbuf[i] > 10) )
{ Serial.print(""); }
else
{ Serial.print(""); Serial.print(-(int)results->rawbuf[i], DEC); Serial.print("-");
}
ESPACE = ESPACE + results->rawbuf[i];
COMPTE++;
}
// Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
}
if (START != 0)
{ Serial.print("");}
}
// Serial.println(CODE);
for (int i=0; i<36; i++)
{ if (CODE==LISTE_CODE[i]) { Serial.println(POS[i]); Serial.println(MESSAGE[i]);} }
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume(); // Receive the next value
}
}
blepharocyte a écrit:Merci pour le lien john ça me sera utile pour la suite !
Bemolu, si j'ai bien compris: tu utilises ton premier code pour détecter le code binaire envoyé par chaque touche de ta télécommande, en ne retenant que celui qui apparait le plus souvent. Puis tu inscrits dans ton second code tous les codes que tu as retenue dans des tableaux pour les traiter en hexadécimal c'est ça ?
J'avoue que ton histoire de blanc + blanc - j'ai beau chercher je comprend rien !
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen;
int ESPACE;
int COMPTE;
int START;
ESPACE = 0;
COMPTE = 0;
START = 0;
for (int i = 1; i < count; i++) {
if ((i % 2) == 1) {
if (START == 0) { if (results->rawbuf[i] > 50) {START = i; Serial.print(results->rawbuf[i], DEC);}; } else
{Serial.print(results->rawbuf[i], DEC);}
}
else {
if (START != 0) {
Serial.print(-(int)results->rawbuf[i], DEC);
ESPACE = ESPACE + results->rawbuf[i];
COMPTE++; }
}
if (START != 0) {Serial.print(" ");}
}
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume(); // Receive the next value
}
}
Could not decode message
Raw (76): 25136 3500 -1700 450 -450 400 -1300 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 400 -1300 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -1300 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400
0
Could not decode message
Raw (76): -29074 3450 -1750 450 -400 450 -1300 450 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 400 -1300 450 -450 400 -500 400 -400 450 -450 450 -450 400 -450 450 -450 400 -400 450 -450 450 -1300 400 -450 450 -400 450 -450 450 -450 400 -450 400 -450 450 -450 400 -450 450 -450 400 -400 450 -450 450 -450 400
0
Could not decode message
Raw (76): -3868 3450 -1750 400 -450 450 -1300 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -400 450 -450 450 -400 450 -450 450 -400 450 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 450 -450 400 -450 400 -450 450 -450 400 -1300 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 400 -450 450
0
Could not decode message
Raw (76): 5724 3450 -1750 450 -400 450 -1300 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -450 400 -450 400 -1300 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -450 400 -400 450 -450 450 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 450 -450 400 -450 400 -450 450 -450 400 -450 450 -450 400 -400 450
0
Could not decode message
Raw (76): 1646 3450 -1750 400 -450 450 -1300 450 -450 400 -400 450 -450 450 -400 450 -450 450 -400 450 -400 450 -450 450 -450 400 -450 450 -400 450 -1300 450 -450 400 -450 450 -450 400 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -1300 450 -450 400 -500 400 -450 400 -450 400 -450 450 -450 400 -450 450 -450 400 -450 400 -450 450 -450 400 -450 450
0
Could not decode message
Raw (76): -31512 3450 -1800 400 -400 450 -1300 450 -450 400 -450 450 -400 450 -450 450 -450 400 -450 400 -500 400 -450 400 -450 450 -400 450 -450 400 -1300 450 -450 450 -400 450 -400 450 -450 450 -450 400 -450 400 -450 450 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 400 -500 400 -400 450 -450 450 -450 400 -400 450 -450 450 -400 450
Could not decode message
Raw (76): -11068 3450 -1750 400 -500 400 -1300 450 -450 400 -450 400 -500 400 -400 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -450 400 -1300 450 -400 450 -450 450 -450 400 -400 450 -450 450 -400 450 -450 400 -450 450 -450 400 -1350 400 -450 400 -450 450 -450 400 -450 450 -450 400 -450 400 -450 450 -400 450 -1300 450 -400 450 -450 450 -450 400
0
Could not decode message
Raw (76): 26846 3450 -1800 400 -450 400 -1350 400 -450 450 -400 450 -400 450 -450 450 -400 450 -450 400 -500 400 -400 450 -450 450 -400 450 -450 400 -1300 450 -450 450 -450 400 -450 400 -450 450 -450 400 -450 400 -450 450 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450
0
Could not decode message
Raw (76): -17698 3450 -1750 450 -450 400 -1300 450 -400 450 -450 400 -500 400 -400 450 -450 450 -450 400 -450 400 -500 400 -400 450 -450 450 -450 400 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 450 -400 450 -400 450 -1300 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -1300 450 -450 400 -500 400 -400 450
0
Could not decode message
Raw (76): 10596 3450 -1750 400 -450 450 -1300 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -400 450 -450 450 -1300 400 -500 400 -400 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -450 400 -1350 400 -450 400 -450 450 -450 400 -450 400 -450 450 -450 400 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450
0
Could not decode message
Raw (76): 7538 3450 -1750 400 -450 450 -1300 450 -400 450 -450 450 -400 450 -450 400 -450 400 -450 450 -450 400 -450 450 -400 450 -450 450 -400 450 -1300 450 -400 450 -450 450 -400 450 -400 450 -450 450 -400 450 -450 400 -500 400 -450 400 -1300 450 -450 400 -500 400 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -1300 450 -450 400 -450 450 -400 450
Could not decode message
Raw (76): 3224 3450 -1750 450 -400 450 -1300 450 -400 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -500 400 -400 450 -1300 450 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 450 -1250 450 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 400 -500 400 -1300 450 -400 450 -450 450
0
Could not decode message
Raw (76): -12540 3450 -1750 450 -450 400 -1300 450 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -450 400 -400 450 -450 450 -400 450 -1300 450 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -1300 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -1300 400 -450 450 -450 400
0
Could not decode message
Raw (76): 5996 3450 -1750 450 -450 400 -1300 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -450 400 -450 400 -1300 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -1300 450 -400 450 -450 450
0
Could not decode message
Raw (76): -9040 3450 -1750 450 -450 400 -1300 450 -450 450 -450 400 -450 400 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -1300 450 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -1300 450 -400 450 -450 450
0
Could not decode message
Raw (76): 18446 3450 -1800 400 -400 450 -1300 450 -450 400 -450 450 -400 450 -450 450 -450 400 -450 450 -450 400 -400 450 -450 450 -450 400 -450 450 -1300 400 -450 450 -400 450 -450 400 -500 400 -400 450 -450 450 -450 400 -450 400 -450 450 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -400 450 -450 450 -450 400 -1300 450 -450 400 -450 450
Could not decode message
Raw (76): -30826 3450 -1750 400 -450 450 -1300 450 -450 400 -400 450 -450 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -450 400 -1300 450 -400 450 -450 400 -450 450 -400 450 -450 450 -400 450 -450 400 -500 400 -450 400 -1350 400 -450 450 -400 450 -400 450 -450 400 -500 400 -450 400 -450 450 -400 450 -1300 450 -1300 450 -450 400 -450 450
0
Could not decode message
Raw (76): 12924 3450 -1750 450 -400 450 -1300 450 -400 450 -450 400 -450 450 -450 400 -450 450 -450 400 -450 400 -450 450 -400 450 -450 450 -400 450 -1300 450 -450 400 -450 450 -400 450 -400 450 -450 450 -450 400 -450 450 -400 450 -450 400 -1300 450 -450 400 -450 450 -450 400 -450 450 -400 450 -450 450 -450 400 -400 450 -1300 450 -1300 450 -400 450 -450 450
0
Could not decode message
Raw (76): 29260 3450 -1750 450 -450 400 -1350 400 -450 400 -450 450 -450 400 -450 450 -400 450 -450 400 -450 450 -450 400 -450 400 -500 400 -400 450 -1350 400 -450 400 -450 450 -400 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 400 -1300 450 -450 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 400 -1300 450 -1350 400 -450 400 -450 450
0
Could not decode message
Raw (76): -21026 3500 -1700 450 -450 450 -1300 400 -450 450 -400 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 450 -1300 400 -450 450 -400 450 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -450 400 -1300 450 -400 450 -450 450 -450 400 -450 400 -450 450 -400 450 -450 400 -500 400 -1300 450 -1300 450 -450 400 -450 400
0
Could not decode message
Raw (76): 6446 3450 -1750 450 -450 400 -1300 450 -400 450 -450 450 -400 450 -450 400 -450 450 -450 400 -450 450 -400 450 -400 450 -450 450 -450 400 -1300 450 -450 400 -450 450 -450 400 -450 400 -500 400 -400 450 -450 450 -450 400 -450 400 -1300 450 -450 450 -450 400 -450 450 -450 400 -400 450 -450 450 -450 400 -450 450 -1250 450 -1350 400 -450 400 -450 450
0
Could not decode message
Raw (76): -3054 3500 -1700 450 -450 450 -1300 400 -450 450 -450 400 -450 450 -450 400 -400 450 -450 450 -450 400 -450 400 -500 400 -450 400 -450 450 -1300 450 -450 400 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 400 -500 400 -1300 450 -400 450 -450 450 -450 400 -450 400 -450 450 -450 400 -450 400 -450 450 -1300 450 -1300 400 -450 450 -450 400
blepharocyte a écrit:Alors voila pour la touche 1:
- Code: Tout sélectionner
Could not decode message
Raw (76): ...
vous y comprenez quelque chose pour traduire en binaire ?
69 -35 9 -9 8 -26 9 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -26 9 -9 8 -9 9 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -9 8 -26 9 -9 9 -9 8 -9 8 -9 9 -9 8 -9 8 -10 8 -9 8 -9 9 -9 8 -9 8 -10 8
70 -34 9 -9 8 -26 9 -9 9 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -9 9 -25 9 -9 9 -9 8 -9 8 -10 8 -9 8 -9 9 -9 8 -9 8 -10 8 -26 10 -7 9 -9 8 -9 9 -9 8 -9 8 -10 8 -9 8 -9 9 -9 8 -9 9 -9 8 -9 8
69 -36 8 -9 8 -26 9 -9 8 -10 8 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -9 9 -9 8 -9 8 -26 9 -9 9 -9 8 -9 8 -9 9 -9 8 -9 9 -9 8 -9 8 -9 9 -26 8 -10 8 -9 8 -9 9 -9 8 -9 8 -9 9 -9 8 -9 8 -10 8 -9 8 -9 9 -9 8
69 -35 9 -9 8 -26 9 -9 8 -9 8 -10 8 -9 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ton code est voici ce que ça donne: |...]
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
int i;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen -1;
if ( (results->rawbuf[1] < 77) and (results->rawbuf[1] > 63) )
{}
else
{ Serial.print("-PAS BON 1:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");}
if ( (results->rawbuf[2] < 39) and (results->rawbuf[2] > 31) )
{}
else
{ Serial.print("-PAS BON 2:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");}
if ( (results->rawbuf[3] < 12) and (results->rawbuf[2] > 7) )
{}
else
{ Serial.print("-PAS BON 3:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");}
for (int i = 4; i < count; i++)
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");
}
}
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");
}
}
}
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume();
}
}
010000000000010000000001000000000000
010000000000010000000001000000001000
010000000000010000000001000000000100
010000000000010000000001000000001100
010000000000010000000001000000000010
blepharocyte a écrit:C'est bien du binaire de 36 bits. Maintenant on fait quoi ?![]()
Sinon j'ai essayer de transmettre un signal IR avec ma LED mais jsuis un peu septique rien ne ce passe.
La patte longue de la LED va bien sur la pin 3 et la patte courte sur un Ground ? Désolé de la vieille question mais j'ai un gros douteJ'ai cablé ainsi et je ne vois même pas la LED s'allumer l'espace d'un chouilla..
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
int i;
const unsigned long P= (((B01000000) * 256 + B00000100 ) * 256 + 00000001) * 16 + B0000; // preambule commun de 28 bits:
const unsigned int T[5] = {B00000000, // les 8 derniers bits sont les différentiateurs
B00001000,
B00000100,
B00001100,
B00000010};
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen -1;
unsigned long PR = 0;
unsigned int TR = 0;
int i=0;
// Le signal s'initialise
if ( (results->rawbuf[1] < 77) and (results->rawbuf[1] > 63) )
{}
else
{ Serial.print("-PAS BON 1:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
if ( (results->rawbuf[2] < 39) and (results->rawbuf[2] > 31) )
{}
else
{ Serial.print("-PAS BON 2:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
if ( (results->rawbuf[3] < 12) and (results->rawbuf[2] > 7) )
{}
else
{ Serial.print("-PAS BON 3:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
// Réception du préambule de 28 bits
for (i = 4; i < 32; i++)
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); PR=PR<<1; }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); PR=PR<<1; PR++; }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
}
};
}; // FIN RECEPTION PREAMBULE
if (PR == P)
{
for (i = 32; i < count; i++) // La fin du code
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); TR=TR<<1; }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); TR=TR<<1; TR++; }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
};
for (i=0; i<5; i++)
{
if (TR==T[i])
{ Serial.print(">> TOUCHE "); Serial.print(++i, DEC); goto RATE;
};
};
}
else
{ Serial.print("PREAMBULE RECU<>ATTENDU"); };
Serial.print(">> Pas de touche correspondante");
RATE:
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume();
};
}
01000000000001PREAMBULE RECU<>ATTENDU>> Pas de touche correspondante
01000000000001PREAMBULE RECU<>ATTENDU>> Pas de touche correspondante
01000000000001PREAMBULE RECU<>ATTENDU>> Pas de touche correspondante
01000000000001PREAMBULE RECU<>ATTENDU>> Pas de touche correspondante
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
int i;
const unsigned long P= (((B01000000) * 256 + B00000100 ) * 256 + B00000001) * 16 + B0000; // préambule commun de 28 bits:
const unsigned int T[5] = {B00000000, // les 8 derniers bits sont les différentiateurs
B00001000,
B00000100,
B00001100,
B00000010};
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen -1;
unsigned long PR = 0;
unsigned int TR = 0;
int i=0;
// Le signal s'initialise
if ( (results->rawbuf[1] < 77) and (results->rawbuf[1] > 63) )
{}
else
{ Serial.print("-PAS BON 1:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
if ( (results->rawbuf[2] < 39) and (results->rawbuf[2] > 31) )
{}
else
{ Serial.print("-PAS BON 2:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
if ( (results->rawbuf[3] < 12) and (results->rawbuf[2] > 7) )
{}
else
{ Serial.print("-PAS BON 3:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
// Réception du préambule de 28 bits
for (i = 4; i < 60; i++)
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); PR=PR<<1; }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); PR=PR<<1; PR++; }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
}
};
}; // FIN RECEPTION PREAMBULE
if (PR == P)
{
for (i = 32; i < count; i++) // La fin du code
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); TR=TR<<1; }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); TR=TR<<1; TR++; }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
};
for (i=0; i<5; i++)
{
if (TR==T[i])
{ Serial.print(">> TOUCHE "); Serial.print(++i, DEC); goto RATE;
};
};
}
else
{ Serial.print("PREAMBULE RECU<>ATTENDU"); };
Serial.print(">> Pas de touche correspondante");
RATE:
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume();
};
}
for (i = 32; i < count; i++) // La fin du code
blepharocyte a écrit:Oui, c'est exactement ce que j'avais fini par faire hier soir pour la boucle for. Il me semble même, je pense, que si on fait cette modif, il faut changer 32 par 60 à cette ligne:
- Code: Tout sélectionner
for (i = 32; i < count; i++) // La fin du code
/* Librairie de lecture IR */
#include <IRremote.h>
/* PIN signal recepteur IR */
int RECV_PIN = 11;
int i;
const unsigned long P= (((B01000000) * 256 + B00000100 ) * 256 + B00000001) * 16 + B0000; // préambule commun de 28 bits:
const unsigned int T[5] = {B00000000, // les 8 derniers bits sont les différentiateurs
B00001000,
B00000100,
B00001100,
B00000010};
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Démarre les interruptions de surveillance du capteur IR
}
void dump(decode_results *results) {
int count = results->rawlen -1;
unsigned long PR = 0;
unsigned int TR = 0;
int i=0;
// Le signal s'initialise
if ( (results->rawbuf[1] < 77) and (results->rawbuf[1] > 63) )
{}
else
{ Serial.print("-PAS BON 1:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
if ( (results->rawbuf[2] < 39) and (results->rawbuf[2] > 31) )
{}
else
{ Serial.print("-PAS BON 2:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
if ( (results->rawbuf[3] < 12) and (results->rawbuf[2] > 7) )
{}
else
{ Serial.print("-PAS BON 3:");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;};
// Réception du préambule de 28 bits
for (i = 4; i < 60; i++)
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); PR=PR<<1; }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); PR=PR<<1; PR++; }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
}
};
}; // FIN RECEPTION PREAMBULE
if (PR == P)
{
for (i = 60; i < count; i++) // La fin du code
{
if ((i % 2) == 0)
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{ Serial.print("0"); TR=TR<<1; }
else
{
if ( (results->rawbuf[i] < 29) and (results->rawbuf[i] > 23) )
{ Serial.print("1"); TR=TR<<1; TR++; }
else
{
Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
}
else
{
if ( (results->rawbuf[i] < 12) and (results->rawbuf[i] > 7) )
{
}
else
{ Serial.print("-PAS BON "); Serial.print(i, DEC); Serial.print(":");Serial.print(results->rawbuf[i], DEC); Serial.print("-");goto RATE;
};
};
};
for (i=0; i<5; i++)
{
if (TR==T[i])
{ Serial.print(">> TOUCHE "); Serial.print(++i, DEC); goto RATE;
};
};
}
else
{ Serial.print("PREAMBULE RECU<>ATTENDU"); Serial.print(P, DEC); Serial.print(" <> "); Serial.print(P, DEC); };
Serial.print(">> Pas de touche correspondante");
RATE:
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume();
};
}
Retourner vers Kit Communication IR
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités