Ciao a tutti,
accantonato al momento il progetto sugli infrarossi (grazie a tutti quelli che mi hanno aiutato!) mi sono messo subito a caccia di un nuovo progetto, ovvero interfacciare il mio fido arduino alle prese telecomandate che ho in casa.
Queste prese vengono telecomandate tramite RF a 433.92 Mhz. Ne ho sacrificata una per vedere come è fatta e ho trovato che moduli riceventi hanno questo modulo RF a tre pin contrassegnato KT-JSMK-6B:
Dove il pin1 è il GND, il pin2 è il "DATA" e il pin3 è il Vcc (5v).
Allora ho provato ad buttare sull'arduino lo sketch del virtualwire preso da un sito da esempio:
#include <VirtualWire.h> // you must download and install the VirtualWire.h to your hardware/libraries folder
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
Serial.begin(9600);
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for RX Link Module
vw_setup(2000); // Bits per sec
vw_set_rx_pin(11); // We will be receiving on pin 23 (Mega) ie the RX pin from the module connects to this pin.
vw_rx_start(); // Start the receiver
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // check to see if anything has been received
{
int i;
// Message with a good checksum received.
for (i = 0; i < buflen; i++)
{
Serial.print(buf[i]); // the received data is stored in buffer
}
Serial.println("");
}
}
ma ovviamente se premo un tasto sul telecomando non succede nulla (e te pareva se mi riusciva alla prima)
Il virtualWire è correttamente installato e il modulo funzionante (perchè rimontato sulla presa riprende a funzionare correttamente)...
avete qualche suggerimento?
devo per forza comprare dei moduli specifici?
GRAZIE!