Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Here is an example code for a 433 MHz RF Transmitter module HTX-1 that can be used with an Arduino board:
- This code uses the VirtualWire library to send a simple message "Hello, World!" over the 433 MHz RF Transmitter module HTX-1. The vw_set_tx_pin() function is used to specify the digital pin that is connected to the transmitter module. The vw_setup() function is used to set the transmission rate in bits per second. In the loop() function, the vw_send() function is used to send the message, and the vw_wait_tx() function is used to wait until the message is sent before sending the next message. The delay() function is used to wait for 1 second between sending messages.
- To use this code, connect the data pin of the HTX-1 module to the digital pin specified in the transmit_pin variable (in this case, pin 10). Connect the power supply and ground of the HTX-1 module to the 5V and ground pins of the Arduino board, respectively.
- Note that the HTX-1 module is a low-cost and low-range RF transmitter module that can be used for simple wireless communication applications. If you require longer range or more advanced features, you may need to use a different module or a different wireless communication protocol.
- */
- #include <VirtualWire.h>
- const int transmit_pin = 10;
- const int transmit_rate = 2000; // in bits per second
- void setup() {
- vw_set_tx_pin(transmit_pin);
- vw_setup(transmit_rate);
- }
- void loop() {
- const char *msg = "Hello, World!";
- vw_send((uint8_t *)msg, strlen(msg));
- vw_wait_tx(); // Wait until the message is sent
- delay(1000); // Wait for 1 second before sending the next message
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement