Bonjour,
J'utilise des modules RF433 avec le code ci-dessous. Tout fonctionne bien mais voila que maintenant cela ne fonctionne plus. En faite ce n'est pas la première fois. je n'arrête pas de galérer sur ce module RF qui fonctionne aléatoirement.
Si quelqu'un a déjà eu le soucis, merci de m'aider.
PS : je débute dans l'Arduino.
#include <VirtualWire.h>
const int BOUTON_1 = 3 ;
const int BOUTON_2 = 7 ;
//const int CAPT_LUM = 0 ;
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
pinMode(BOUTON_1, INPUT) ;
pinMode(BOUTON_2, INPUT) ;
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_tx_pin(5) ;
vw_setup(2000); // Bits per sec
}
void loop()
{
const char *msg = "hello";
int btn = digitalRead(BOUTON_1) + digitalRead(BOUTON_2) ;
//Serial.println( analogRead(CAPT_LUM) ) ;
if ( btn ) {
digitalWrite(13, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13, false);
delay(500);
}
}
#include <VirtualWire.h>
int Lumiere = LOW ;
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(7) ;
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;
Serial.println(vw_get_message(buf, &buflen));
if (vw_get_message(buf, &buflen)) // Non-blocking
{
Lumiere = !Lumiere ;
digitalWrite(9, Lumiere);
Serial.println("Etat Lumiére : ") ;
Serial.print(Lumiere) ;
}
}