Bonjour,
Je viens de créer un va-et-vient sans fil. Le système fonctionne bien toutefois par moment celui-ci ne fonctionne plus puis refonctionne sans rien faire.
Je pense que cela vient du récepteur qui n'entend pas bien.
Pensez-vous que je devrais ajouter un condensateur :
L'ensemble du Va-Et-Vient
Le Recepteur
L'Emetteur
L'Emetteur
#include <VirtualWire.h>
const int TRANSMETTEUR = 9 ;
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("Emetteur Setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
//vw_set_tx_pin(TRANSMETTEUR) ;
vw_setup(2000); // Bits per sec
const char *msg = "hello";
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx(); // Wait until the whole message is gone
//delay(300000);
}
void loop()
{
}
Le Recepteur
#include <VirtualWire.h>
const int RECEPTEUR = 2 ;
const int RELAIS = 4 ;
int Etat_Lum = LOW ;
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("Recepteur Setup");
pinMode(RELAIS, OUTPUT) ;
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(RECEPTEUR) ;
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
Etat_Lum = !Etat_Lum ;
digitalWrite(RELAIS, Etat_Lum);
}
}
En vous remerciant par avance.