Paso 2: Software
RF_RECEIVER
#include int input1 = 3; Arduino'nun 3. bağlanmıştır de pinine digital. int entrada2 = 4; Arduino'nun 4. bağlanmıştır de pinine digital. const int receive_pin = 9; void setup() {delay(1000); vw_set_rx_pin(receive_pin); vw_set_ptt_inverted(true); vw_setup(2000); vw_rx_start(); pinMode (input1, salida); pinMode (salida de entrada2,);} void loop() {uint8_t buf [VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; if (vw_get_message (buf & buflen)) {if(buf[0]=='1') digitalWrite(input1,HIGH); digitalWrite(input2,LOW);} if(buf[0]=='0') {digitalWrite (input1 BAJA); digitalWrite(input2,LOW); } }
RF_TRANSMITTER_BUTTON #include //kütüphanemizi ekledik. const int buton1 = 7; int butondurumu = 0;
void setup() {pinMode (buton1, entrada); vw_set_tx_pin(12); vw_setup(2000);} void loop() {butondurumu = digitalRead(buton1); si (butondurumu == HIGH) {char mensaje [1] = {'1'}; vw_send ((uint8_t *) msg, 1); vw_wait_tx(); delay (100);} else {char mensaje [1] = {'0'}; vw_send ((uint8_t *) msg, 1); vw_wait_tx(); delay (100);}}