#include //This Library is for wireless rx and tx modules #define led 13 // For good visual realization that everything is working fine....... #define receive_msg 9 void setup() { delay(1000); // Just to stop for startup Serial.begin(9600); pinMode(led,OUTPUT); vw_set_rx_pin(receive_msg); // Set the pin as RX to receive message vw_setup(2400); // TO setup the baud rate vw_rx_start(); } void loop() { byte buf[VW_MAX_MESSAGE_LEN]; // 'buf' array to store the message.......you can change the 'byte' to 'uint8_t'......if you dont know what does 'uint8_t' means plzz visit http://blog.oscarliang.net/arduino-difference-byte-uint8-t-unsigned-cha/ byte buflen = VW_MAX_MESSAGE_LEN; // To store the message length in buflen if(vw_get_message(buf, &buflen)) //this switches true if any message is received ......I dont really known why the pointer operator is required { int i; digitalWrite(led,HIGH); // The led goes High if the receiver gets any message for(i = 0; i < buflen; i++) // This for loop is a bit confusing part...... { int convt = int(buf[i]); // Converting the distance to integer type because the HC-SR04 sends the value from 0-200.....and byte = 2^7 = 0 to 127 if(convt<0) // This is required coz if the value 'convt' is greater than 127 then it will turn -ve........ e.g. int = 128,129,130.....,200 ---> byte = -128,-127,-126...... ,-(200-256)[ i.e. 128+128=256 convt = int(buf[i])+256; Serial.print("Got: "); Serial.print(i+1); // Signifes from which sensor di it get the data from 1 means left......2 means right Serial.println(". "); Serial.print(convt); // Print the converted message/integer Serial.println(' '); } Serial.println(); digitalWrite(led,LOW); //LED goes off to signify that data transmission is completed ..........or is stopped } }