// Modified by Mithat Konar from // Henry's Bench // Arduino Nokia 5110 U8Glib Tutorial // http://henrysbench.capnfatz.com/henrys-bench/arduino-displays/arduino-nokia-5110-with-u8glib-tutorial/ #include "U8glib.h" /* * Notes: * With u8g_font_profont11, uses 23% of program storage space and 11% of dynamic memory. * With u8g_font_fur30r, uses 38% of program storage space and 11% of dynamic memory. */ /* Pin assignments: * RST: 8 * CE/CS/SCE: 10 * DC/"D/C": 9 * DIN/DN/MOSI/DATA: 11 * CLK/SCLK/SCK: 13 * VCC: 3.3V * LIGHT/LED: ground through 330 ohm resistor * GND: ground */ const unsigned int CLOCK_PIN = 13, DATA_PIN = 11, CS_PIN = 10, DC_PIN = 9, RESET_PIN = 8; // Declare the display and assign the pins U8GLIB_PCD8544 u8g(CLOCK_PIN, DATA_PIN, CS_PIN, DC_PIN, RESET_PIN); // CLK=8, DIN=4, CE=7, DC=5, RST=6 void draw() { u8g.setFont(u8g_font_profont11); // select font // u8g.setFont(u8g_font_fur30r); u8g.drawStr(0, 15, "Nokia 5110"); // write a string at position X, Y u8g.drawStr(0, 35, "Hello world!"); } void setup() { u8g.setContrast(138); } void loop() { u8g.firstPage(); do { draw(); } while( u8g.nextPage() ); }