I have a project I am working on use 433MHz radios and I am not getting an expected result.
Here is the transmitter code:
#include <RH_ASK.h>
#include <SPI.h>
RH_ASK rf_driver(2000, 11, 11, 0); // (speed, Tx pin, Rx pin, PTT enable)
void setup() {
Serial.begin(115200); //setting baud rate
pinMode(11, OUTPUT);
rf_driver.init();
}
void loop() {
const char *msg = "013:0";
rf_driver.send((uint8_t *)msg, 5);
rf_driver.waitPacketSent();
}
And here is my receiver code:
#include <RH_ASK.h>
#include <SPI.h>
RH_ASK rf_driver(2000, 11, 11, 0); // (speed, Tx pin, Rx pin, PTT enable)
void setup() {
Serial.begin(115200); //setting baud rate
pinMode(11, INPUT);
rf_driver.init();
}
void loop() {
uint8_t buf[5];
uint8_t buflen = sizeof(buf);
if (rf_driver.recv(buf, &buflen)) {
Serial.print("Message received: ");
Serial.println((char*)buf);
}
}
It works but the message that prints on the screen is
I am posting an image because it contains an invalid character that I cannot copy and paste here.
Obviously I just want the 013:0.
I feel like I am messing up data types or something but I such a noob with this stuff so be gentle with me....lol