Advertisement
microrobotics

Radiometrix RX Module 434.650 MHZ

Apr 14th, 2023
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. The Radiometrix RX Module 434.650 MHz is an RF receiver module that can be used for wireless communication with a microcontroller like Arduino. In this example, I'll provide you with an Arduino code to receive data using the Radiometrix RX module. Note that this code assumes you are using an Arduino Uno or a similar board.
  3.  
  4. First, connect the Radiometrix RX module to the Arduino as follows:
  5.  
  6. Vcc to 5V
  7. GND to GND
  8. DATA to Digital Pin 2
  9.  
  10. Upload this code to your Arduino and open the Serial Monitor. The Arduino will listen for incoming data from the Radiometrix RX module and display the received data in the Serial Monitor.
  11.  
  12. Make sure you have a compatible Radiometrix TX module (transmitter) sending data at the same frequency (434.650 MHz) and communication speed (10 Kbps) for this code to work correctly. You can use the VirtualWire library to implement the transmitter side as well.
  13. */
  14.  
  15. // Radiometrix RX Module 434.650 MHz, 10KB
  16. // Example code for Arduino
  17.  
  18. #include <VirtualWire.h>
  19.  
  20. const int dataPin = 2; // Connect the DATA pin of the RX module to Digital Pin 2
  21.  
  22. void setup() {
  23.   Serial.begin(9600); // Initialize the serial communication for debugging
  24.   vw_set_rx_pin(dataPin); // Set the data pin for the VirtualWire library
  25.   vw_setup(10000); // Set the communication speed (10 Kbps)
  26.   vw_rx_start(); // Start the receiver
  27. }
  28.  
  29. void loop() {
  30.   uint8_t buf[VW_MAX_MESSAGE_LEN];
  31.   uint8_t buflen = VW_MAX_MESSAGE_LEN;
  32.  
  33.   if (vw_get_message(buf, &buflen)) { // Check if a message is received
  34.     Serial.print("Received: ");
  35.     for (int i = 0; i < buflen; i++) {
  36.       Serial.write(buf[i]); // Print the received data byte by byte
  37.     }
  38.     Serial.println();
  39.   }
  40. }
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement