RF TRANSMITTER AND RECEIVER

Thread Starter

AJIN NADH

Joined Dec 18, 2014
84
Hi,
I used rf 433 mhz transmitter and receiver to transmitt bit 1 and 0, But its not working properly , is it need DECODER Ic...?
am attaching the arduino program and photo of the transreceiver

Code:
//simple Tx on pin D12
//Written By : Mohannad Rawashdeh
// 3:00pm , 13/6/2013
//[URL]http://www.genotronex.com/[/URL]
//..................................
#include <VirtualWire.h>
char *controller;
void setup() {
  pinMode(13,OUTPUT);
vw_set_ptt_inverted(true); //
vw_set_tx_pin(12);
vw_setup(4000);// speed of data transfer Kbps
}

void loop(){
controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,1);
delay(2000);
controller="0"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,0);
delay(2000);

}
and this is code for receiver :

The D13 LED On the arduino board must be turned ON when received character '1' and Turned Off when received character '0'

Code:
//simple Tx on pin D12
//Written By : Mohannad Rawashdeh
// 3:00pm , 13/6/2013
//[URL]http://www.genotronex.com/[/URL]
//..................................
#include <VirtualWire.h>
void setup()
{
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_set_rx_pin(12);
  vw_setup(4000);  // Bits per sec
  pinMode(13, OUTPUT);

  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
  {
  if(buf[0]=='1'){


  digitalWrite(13,1);
  }
  if(buf[0]=='0'){
  digitalWrite(13,0);
  }

}
}

Regards,
Ajin Nadh

Moderators note: Please use code tags for pieces of code
 

Attachments

Last edited by a moderator:
Top