6.- Radio Frequency 433 MHZ. Standalone.
- To test these examples outdoors, it is better to use a display instead of the PC's Serial Monitor. In this example I use a LCD with I2C bus, you can also use other OLED type displays.
- There are two very important elements in Radio Frequency: the antenna and the power supply.
You can try other types of antennas, in this case the best are Yagi directional antennas.
The power supply should be stable and has no noise, with a battery it will work better.
- Arduino. Receiver code. Display LCD with I2C.
#include <RH_ASK.h>
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
// LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
RH_ASK rf_driver;
void setup(){
Serial.begin(9600);
rf_driver.init();
lcd.begin(16,2);// Columnas y filas de LCD.
}
void loop(){
uint8_t buf[16] = {""}; // Size buffer 16.
uint8_t buflen = sizeof(buf);
if (rf_driver.recv(buf, &buflen)){
// Serial.println((char*)buf);
lcd.clear();
lcd.setCursor(0,0);
lcd.print((char*)buf);
}
}
