No-name 128x64 LCD screen

I have a couple of 12864B v2.0 LCDs I got from eBay, and I am trying to use the U8G2 lib to get it to do something.

Anyone have recommendations on how I can use U8G2lib in parallel mode? I am pretty sure that it is a ST7920 chipset.

Thanx!

I got it to work, so now I can proceed to the various tweaks I want. :slight_smile:

Such as current Julian date, using a smaller arduino so I can package it all up, and figuring out how to set the date and time without having to update the sketch through the IDE ( using buttons and such ).

//==========================================================
//CODE CALCULATES DAYS BETWEEN NOW AND 1ST JAN 2015
int daysSince2015 (int days, int months, int years)
{
  int daysPerMonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
  
  int daysPassed = 0;
  
  int startDays = 1;
  int startMonth = 1;
  int startYears = 2015;
  
  //KEEP SCROLLIN' TILL THE REQUIRED YEAR IS REACHED
  for (startYears = 2015; startYears != years; startYears ++)
  {
    for (int n = 0; n < 12; n++)
    {
      //ONE MONTH AT A TIME
      daysPassed += daysPerMonth [n];
      //ADD LEAP DAY IF REQUIRED
      if ((n == 1) && ((startYears % 4) == 0))
      {
        daysPassed += 1;
      }
    }
  }
  //SCROLL MONTHS IF THE MONTHS IS NOT JANUARRY
  if (startMonth != months)
    {
      //SCROLL MONTH, USE startMonth AS A CURSOR TO daysPerMonth ARRAY
      //KEEP IN MIND THAT 1ST ELEMENT OF daysPerMonth ARRAY IS AT daysPerMonth[0]
      for (startMonth = 1; startMonth != months; startMonth ++)
      {
          //ONE MONTH AT A TIME
          daysPassed += daysPerMonth [startMonth - 1];
          //ADD A DAY IF IT'S FEBRUARY OF A LEAP YEAR
          if ((startMonth == 2) && ((startYears % 4) == 0))
          {
            daysPassed += 1;
          }
      }
    }
    
    //SINCE WE ARE ON THE SAME MONTH AND YEAR, JUST CALCULATE DAY DIFFERENCE
    daysPassed += days - startDays;
    //PRINT THE RESULT
    Serial.print("DAYS PASSEDS: ");
    Serial.println(daysPassed);
    //RETURN THE RESULT
    return daysPassed;
  
}
//=============================================================

int calculateDayOfYear(int day, int month, int year) {
  
  // Given a day, month, and year (4 digit), returns 
  // the day of year. Errors return 999.
  
  int daysInMonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
  
  // Verify we got a 4-digit year
  if (year < 1000) {
    return 999;
  }
  
  // Check if it is a leap year, this is confusing business
  // See: https://support.microsoft.com/en-us/kb/214019
  if (year%4  == 0) {
    if (year%100 != 0) {
      daysInMonth[1] = 29;
    }
    else {
      if (year%400 == 0) {
        daysInMonth[1] = 29;
      }
    }
   }

  // Make sure we are on a valid day of the month
  if (day < 1) 
  {
    return 999;
  } else if (day > daysInMonth[month-1]) {
    return 999;
  }
  
  int doy = 0;
  for (int i = 0; i < month - 1; i++) {
    doy += daysInMonth[i];
  }
  
  doy += day;
  return doy;
}

date_time_temp_humidity_2.ino (3.85 KB)