Bonjour,

Je cherche a programmer un teensy 3.2 avec 2 antennes RF1100SE afin de pouvoir émettre et recevoir un code. J'ai pour cela utilisé le code de la librairie RCSwitch.

Emission:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
  Example for different sending methods
  
  http://code.google.com/p/rc-switch/
  
*/
 
#include <RCSwitch.h>
 
RCSwitch mySwitch = RCSwitch();
 
void setup() {
 
  Serial.begin(9600);
 
  // Transmitter is connected to Arduino Pin #10  
  mySwitch.enableTransmit(11);
 
  // Optional set pulse length.
  // mySwitch.setPulseLength(320);
 
  // Optional set protocol (default is 1, will work for most outlets)
  // mySwitch.setProtocol(2);
 
  // Optional set number of transmission repetitions.
  // mySwitch.setRepeatTransmit(15);
 
}
 
void loop() {
 
  /* See Example: TypeA_WithDIPSwitches */
  mySwitch.switchOn("11111", "00010");
  delay(1000);
  mySwitch.switchOn("11111", "00010");
  delay(1000);
 
  /* Same switch as above, but using decimal code */
  mySwitch.send(5393, 24);
  delay(1000);  
  mySwitch.send(5396, 24);
  delay(1000);  
 
  /* Same switch as above, but using binary code */
  mySwitch.send("000000000001010100010001");
  delay(1000);  
  mySwitch.send("000000000001010100010100");
  delay(1000);
 
  /* Same switch as above, but tri-state code */ 
  mySwitch.sendTriState("00000FFF0F0F");
  delay(1000);  
  mySwitch.sendTriState("00000FFF0FF0");
  delay(1000);
 
  delay(20000);
}
Réception:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
  Simple example for receiving
  
  http://code.google.com/p/rc-switch/
*/
 
#include <RCSwitch.h>
 
RCSwitch mySwitch = RCSwitch();
 
void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2
}
 
void loop() {
  if (mySwitch.available()) {
 
    int value = mySwitch.getReceivedValue();
 
    if (value == 0) {
      Serial.print("Unknown encoding");
    } else {
      Serial.print("Received ");
      Serial.print( mySwitch.getReceivedValue() );
      Serial.print(" / ");
      Serial.print( mySwitch.getReceivedBitlength() );
      Serial.print("bit ");
      Serial.print("Protocol: ");
      Serial.println( mySwitch.getReceivedProtocol() );
    }
 
    mySwitch.resetAvailable();
  }
}
Quand je mets le code de l'émission et que je relie le pin 11 du teensy 3.2 sur l'entrée en ligne du PC, je vois bien la séquence dans Audacity.

Par contre, quand je mets le code de la réception, que je relie le pin 12 au PC et que j'envoie le code de la télécommande, il n'y a rien.

Le code de réception précise le pin 2 d'un Arduino Uno. Est-ce que je me trompe de pin sur le Teensy (pin 12 = DIN) ou bien fais-je une autre erreur ?

Merci de m'aider.