#include "U8glib.h" // include U8glib library from https://code.google.com/p/u8glib/
U8GLIB_ST7920_128X64 u8g(7, 5, 4, U8G_PIN_NONE); // pins on display : E = 7, RW = 5, RS = 4
void setup(void) {
// SETUP DISPLAY
u8g.setRot180();
pinMode(6, OUTPUT); // set pin 6 to OUTPUT to control backlight (any PWM pin works)
analogWrite(6, 255); // enter a value between 0 and 255
if ( u8g.getMode() == U8G_MODE_R3G3B2 )
u8g.setColorIndex(255); // white
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
u8g.setColorIndex(3); // max intensity
else if ( u8g.getMode() == U8G_MODE_BW )
u8g.setColorIndex(1); // pixel on
}
// Do all your drawing in this function, this is just an example
void draw(void) {
u8g.setFont(u8g_font_helvR08);
u8g.setPrintPos(0,10);
u8g.print("Thermostaat ");
u8g.drawFrame(117,0,10,6);
u8g.drawFrame(127,2,1,2);
u8g.drawBox(119,2,3,2);
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
delay(1000);
}