init
This commit is contained in:
25
rf_tx/rf_tx.ino
Normal file
25
rf_tx/rf_tx.ino
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <RH_ASK.h> // RadioHead library
|
||||
#include <SPI.h> // Required for RadioHead, though not used directly
|
||||
|
||||
// Initialize the RF transmitter (default pin is 12, change if needed)
|
||||
RH_ASK rf_driver(2000, 10, 10); // 2000 bps, DATA pin on 10
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
if (!rf_driver.init()) {
|
||||
Serial.println("RF Transmitter initialization failed!");
|
||||
}
|
||||
|
||||
|
||||
pinMode(3, INPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
while(digitalRead(3))
|
||||
delay(100);
|
||||
const char *msg = "Hello, RFF World!"; // Message to send
|
||||
rf_driver.send((uint8_t *)msg, strlen(msg)); // Send the message
|
||||
rf_driver.waitPacketSent(); // Wait until the message is sent
|
||||
Serial.println("Message sent: Hello, RFF World!");
|
||||
delay(500); // Wait 1 second before sending again
|
||||
}
|
||||
Reference in New Issue
Block a user