I'm trying to use an Lolin New nodeMCU v3 and a 433mhz receiver card. The code works fine if using an arduino uno and the 433mhz card, only one line needs to be changed to run it on the ESP8266. The thing is I cant get the esp8266 to receive the messages, the serial shows all scrambled text, I tried different baud rates with no effect. Anyone has a idea how to fix this? Thanks Alex
for arduino uno
RH_ASK driver(2000, 11, 12, 10, true);
for ESP8266
RH_ASK driver(2000, 16, 12, 10, true); // ESP8266: do not use pin 11
complete code
#include <RH_ASK.h>
#include <SPI.h>
//RH_ASK driver;
RH_ASK driver(2000, 16, 12, 10, false); // ESP8266: do not use pin 11
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen)) // Non-blocking
{
// Message with a good checksum received, dump it.
driver.printBuffer("Got:", buf, buflen);
String rcv;
for (int i = 0; i <buflen; i++){
rcv +=(char)buf[i];
}
Serial.println(rcv);
}
}