Пример #1
0
void setup() {                
  
  // initialize and set the contrast to 0x18
  glcd.begin(0x18);

  // show splashscreen
  glcd.display(); 
  delay(500);
  glcd.clear(); 
  
  // turn on backlight
  pinMode(BACKLIGHT_LED, OUTPUT);
  digitalWrite(BACKLIGHT_LED, HIGH);

  // For I2C
  Wire.begin();

  // For console debugging
  Serial.begin(9600);

  // Configure the ladder
  a5b.setLadder(3.3, ladder);
  a5b.removeState(17);
  a5b.removeState(18);
  a5b.setTiming(20, 3);

  for (int i=0; i<5; i++) {
    buttonsX[5-i-1] = startX+i*squareSpacing;
  }

  counter = 0;
  prevtime = millis();
}
Пример #2
0
void LCD_ST7565::formatHalfTime(uint32_t time, uint8_t line, uint8_t offset)
{
  char timestring[6];
  uint32_t msToSecond = time/10;
  
  int2str(timestring,(msToSecond/60)%60);
  timestring[2] = ':';
  int2str(timestring+3,msToSecond%60);
  timestring[5] = 0;
  glcd.drawstring(0+offset,line,timestring);
}
Пример #3
0
void LCD_ST7565::formatFullTime(uint32_t time, uint8_t line, uint8_t offset)
{
  char timestring[12];
  uint32_t msToSecond = time/10;
  
  int2str(timestring,msToSecond/86400);
  timestring[2] = ':';
  int2str(timestring+3,(msToSecond/3600)%24);
  timestring[5] = ':';
  int2str(timestring+6,(msToSecond/60)%60);
  timestring[8] = ':';
  int2str(timestring+9,msToSecond%60);
  timestring[11] = 0;
  glcd.drawstring(0+offset,line,timestring);
}
Пример #4
0
void LCD_ST7565::updateCounter(uint32_t time)
{
  glcd.clear();
  glcd.drawstring(0,0,"Operator:");
  glcd.drawstring(0,1,"Lord Clancy");
  formatHalfTime(time, 2, 0);
  formatFullTime(time, 2, 61); // 128 pixels - (11 chars * 6 pixels) = 62 - 1
  
  glcd.drawstring(0,4,"Maintain in:");
  formatHourTime(time, 4, 79); // 128 pixels - (8 chars * 6 pixels) = 80 - 1
  
  glcd.drawstring(0,6,"Machine Time:");
  formatFullTime(time, 7, 0);

  glcd.display();
}
Пример #5
0
void loop()                     
{
  //glcd.clear();

  a5b.update();

  byte bm = 1;
  for ( int i=0; i<5; i++ ) {
    int state = a5b.getState(bm);
    if ( state ) {
      glcd.fillrect(buttonsX[i], startY, squareSize, squareSize, 1);
    }
    else {
      glcd.fillrect(buttonsX[i]+1, startY+1, squareSize-2, squareSize-2, 0);
      glcd.drawrect(buttonsX[i], startY, squareSize, squareSize, 1);
    }
    bm = bm << 1;
  }
  

  unsigned long newtime = millis();
  int elapsed = newtime-prevtime;
  String str(elapsed, DEC);
  str.toCharArray(elapsedStr, 8);
  prevtime = newtime;

  glcd.drawstring(8, 4, blank);
  glcd.drawstring(8, 4, elapsedStr);

  glcd.display();

  counter++;

  delay(WAIT_LOOP);

}
Пример #6
0
void LCD_ST7565::start(void)
{
  glcd.clear();
  glcd.drawstring(0,0,"Hello World");
  glcd.display();
}
Пример #7
0
void LCD_ST7565::init(void)
{
  glcd.begin(0x18);
  glcd.display(); // show splashscreen
}