I tried to test the range of a 433MHz sensor with the Radiohead library. For easier handly I wanted to have a small message printed to an OLED screen.
Because the Adafruit library wouldn't work because it is too big, I tried the SSD1306ASCII library which still seems to be too big. As it wouldn't compile:
#include <Wire.h>
// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C
#include "SSD1306Ascii.h"
#include "SSD1306AsciiAvrI2c.h"
SSD1306AsciiAvrI2c oled;
#include <RH_ASK.h>
#include <SPI.h>
//RH_ASK driver;
RH_ASK driver(2000, 2, 11, 0); // Speed 2000, RxPin 2, TxPin 11, pttPin 0 - ESP8266 or ESP32: do not use pin 11 or 2
// RH_ASK driver(2000, 3, 4, 0); // ATTiny, RX on D3 (pin 2 on attiny85) TX on D4 (pin 3 on attiny85),
void setup() {
Serial.begin(9600); // Debugging only
// initialize display
oled.begin(&Adafruit128x64, I2C_ADDRESS);
// oled.clearDisplay();
}
void loop()
{
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];//[18];//[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
//if (driver.recv(buf, &buflen)) // Non-blocking
// if (rf_driver.recv(buf, &buflen)) // Non-blocking
{
Serial.print("Message Received: ");
Serial.println((char*)buf);
/*int i;
// Message with a good checksum received, dump it.
driver.printBuffer("Got:", buf, buflen);*/
oled.clear();
oled.setFont(System5x7);
oled.print("Message Received: ");
oled.print((char*)buf);
oled.print(buflen);
}
}
Is there any way to make this work on a Nano or Uno? As far as I know there is no smaller library than the SSD1306ASCII. Is it possible to reduce the size of the Radiohead library or is there a smaller library to reliably send text and sensor data?
Print your post. Use a highlighter to highlight the facts. You didn't need to take the cap off, did you?
Post a link to the libraries you are trying to use. Post your code. Post a link to the OLED device you are trying to write to. Post the results of compiling the code, where you claim to have determined that some library is too big.
There are Mega clones that are the same size as the Uno, with 4 times the SRAM and much more program space, if that is really the issue.
Thank you for the reply. Which code would you like me to post? I posted the receiver code in the initial post. BTW if I comment the RH constructor out the compiling works.
The error message from the IDE is in the attachment.
moserroger:
Because the Adafruit library wouldn't work because it is too big, I tried the SSD1306ASCII library which still seems to be too big. As it wouldn't compile:
The SSD1306ASCII library is indeed very memory efficient.
Your program compiles, on a working IDE, for a UNO to 27% of Flash and 36% of memory, plenty of spare space.