#include "Adafruit_GFX.h"
#include "KS0108_GLCD.h"
#define LCD_DI  A0
#define LCD_RW  A1
#define LCD_E   A2
#define LCD_CS1 10
#define LCD_CS2 11
#define LCD_RST 12
static KS0108_GLCD glcd(LCD_DI,
                        LCD_RW,
                        LCD_E,
                        2, 3, 4, 5, 6, 7, 8, 9,
                        LCD_CS1,
                        LCD_CS2,
                        LCD_RST);
void setup()
{
  Serial.begin(115200);
  glcd.begin(KS0108_CS_ACTIVE_HIGH);
  glcd.clearDisplay();
  glcd.display();
}
static int16_t x = 0;
static int16_t y = 0;
static uint16_t color = KS0108_ON;
void loop()
{
  glcd.drawPixel(x, y, color);
  glcd.display();
  x = x + 1;
  if (x == 128)
  {
    x = 0;
    y = y + 1;
    Serial.print("y = "); Serial.print(y); Serial.print("\n");
    if (y == 64)
    {
      y = 0;
      color = (color == KS0108_ON) ? KS0108_OFF : KS0108_ON;
    }
  }
}