I have an Arduino Nano connected to a RTC and a 0.96" OLED module. I have written a program to convert the date into the Hebrew (lunar-solar) date using Gauss's Passover formula and calculate the time of sunset (necessary as the Hebrew date changes at nightfall (here defined as 72 minutes after sunset) using the Dusk2Dawn library, which is a port from NOAA's Solar Calculator.
It also displays a couple of other times which are relevant in Jewish Law.
The problem is that Hebrew dates are generally expressed in Hebrew letters rather than numbers, so I needed to use strings to convert. This has caused me to (I think) run out of memory, as when I comment out either of these two lines:
u8g2_for_adafruit_gfx.print(hebMonthName[hebMonth - 1]);
u8g2_for_adafruit_gfx.print(hebDateName[hebDate - 1]);
the code runs perfectly. So I can show either the month, or the date, but not both. If both lines are included, the code appears to upload, but then doesn't run at all.
I have tried changing
char * hebMonthName[] = {" ןסינ ", " רייא ", " ןויס ", " זומת ", " בא " , " לולא ", " ירשת ", " ןושח ", " ולסכ ", " תבט ", " טבש ", " רדא ", " 'א רדא ", " 'ב רדא "};
to
const char mo0[] PROGMEM = " ןסינ ";
const char mo1[] PROGMEM = " רייא ";
const char mo2[] PROGMEM = " ןויס ";
const char mo3[] PROGMEM = " זומת ";
const char mo4[] PROGMEM = " בא ";
const char mo5[] PROGMEM = " לולא ";
const char mo6[] PROGMEM = " ירשת ";
const char mo7[] PROGMEM = " ןושח ";
const char mo8[] PROGMEM = " ולסכ ";
const char mo9[] PROGMEM = " תבט ";
const char mo10[] PROGMEM = " טבש ";
const char mo11[] PROGMEM = " רדא ";
const char mo12[] PROGMEM = " 'א רדא ";
const char mo13[] PROGMEM = " 'ב רדא ";
const char * hebMonthName[] = {mo0,mo1,mo2,mo3,mo4,mo5,mo6,mo7,mo8,mo9,mo10,mo11,mo12,mo13};
char buffer [9];
and in the loop
for (int i = 0; i < 14; i++) {
strcpy_P(buffer, (char *)pgm_read_word(&(hebMonthName[i])));
u8g2_for_adafruit_gfx.print(buffer);}
but it just caused the OLED to flash continuously and didn't show the month at all. Any suggestions? I am somewhat limited in the OLED library I can use as very few contain Hebrew fonts. Using a Mega wouldn't work, as I need the small size of the Nano.
Complete code attached, as otherwise I'd be over the 9,000 character limit.
hebrewOlcd.ino (9.96 KB)