Lo primero es saludar a todos los "foreros" porque ésta es mi primera intervención. He estado buscando pero no encuentro respuesta a mi problema. Adjunto mi pequeño programa para ver la hora,fecha, temperatura y humedad en oled 128x32 I2C. Me funciona perfectamente en 128x64 I2C y SPI pero en el 128x32 me ocupa el 99% solo con hora,fecha y temperatura. ¿Qué me ocupa tanto espacio?. En 128x64 moviendo los datos no llega al 60% pero aquí se desborda la memoria:
#include <Wire.h>
#include "DHT_U.h"
DHT dht(2,DHT22); // pin de conexión y tipo de dht
#include "U8glib.h"
#include "RTClib.h" // Include library for RTC (Real Time Clock module)
RTC_DS3231 RTC;
U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);
//#define SSD1306_I2C_ADDRESS 0x3C //<<< Seleccion de 128x64
int x=1000; // poner los milisegundos que estará cada pantalla visualizándose
char hora [5], dia [2];
String meses [12] = {"ENE","FEB","MAR","ABR","MAY","JUN","JUL","AGO","SEP","OCT","NOV","DIC"};
void setup() {Wire.begin ();dht.begin(); RTC.begin(); }// fin Setup
void loop () {u8g.firstPage();do{DateTime now = RTC.now();u8g.setFont(u8g_font_fub30r);sprintf(hora, "%02d:%02d", now.hour(),now.minute()); u8g.setPrintPos (5,32); u8g.print (hora);} while (u8g.nextPage());delay (x);
u8g.firstPage(); do{drawFecha();}while (u8g.nextPage()); delay (x); u8g.firstPage(); do{ drawTempC();} while (u8g.nextPage()); delay (x); u8g.firstPage(); do{ drawHum();}while (u8g.nextPage());delay (x); }////////////// fin loop
void drawFecha () {DateTime now = RTC.now(); u8g.setFont(u8g_font_fub30r); u8g.setPrintPos (5,32); if (now.day() <=9) {u8g.print ("0"); u8g.print (now.day());} else {u8g.print (now.day());} u8g.setFont(u8g_font_fub25); u8g.print (meses [(now.month() - 1)]);}
void drawTempC () {int t = dht.readTemperature(); u8g.setFont(u8g_font_fub30r); u8g.setPrintPos (5,32); u8g.print (t); u8g.print (" ");u8g.write(0xdf); u8g.setFont(u8g_font_fub25); u8g.print("C");}
void drawHum () {int h = dht.readHumidity (); u8g.setFont (u8g_font_fub30r); u8g.setPrintPos (0,32); u8g.print (h); u8g.setFont(u8g_font_orgv01r); u8g.print (" %");}
El programa está reducido a una línea por instrucción pero ni así consigo que quepa. ¿Puede ser por los "font"?. Agradezco todas las ayudas y sugerencias.