Advertisement
microrobotics

Radiometrix TX Module 434.650 MHz

Apr 14th, 2023
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. The Radiometrix TX Module 434.650 MHz is an RF transmitter 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 send data using the Radiometrix TX module. Note that this code assumes you are using an Arduino Uno or a similar board.
  3.  
  4. First, connect the Radiometrix TX module to the Arduino as follows:
  5.  
  6. Vcc to 5V
  7. GND to GND
  8. DATA to Digital Pin 12
  9.  
  10. Upload this code to your Arduino. The Arduino will send the message "Hello, World!" using the Radiometrix TX module every 2 seconds.
  11.  
  12. Make sure you have a compatible Radiometrix RX module (receiver) listening for 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 receiver side as well, as I provided in the previous answer.
  13. */
  14.  
  15. // Radiometrix TX Module 434.650 MHz
  16. // Example code for Arduino
  17.  
  18. #include <VirtualWire.h>
  19.  
  20. const int dataPin = 12; // Connect the DATA pin of the TX module to Digital Pin 12
  21.  
  22. void setup() {
  23.   Serial.begin(9600); // Initialize the serial communication for debugging
  24.   vw_set_tx_pin(dataPin); // Set the data pin for the VirtualWire library
  25.   vw_setup(10000); // Set the communication speed (10 Kbps)
  26. }
  27.  
  28. void loop() {
  29.   const char *message = "Hello, World!"; // The message to be sent
  30.  
  31.   vw_send((uint8_t *)message, strlen(message)); // Send the message
  32.   vw_wait_tx(); // Wait until the message is sent
  33.  
  34.   Serial.println("Message sent: ");
  35.   Serial.println(message);
  36.  
  37.   delay(2000); // Wait for 2 seconds before sending the next message
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement