Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Program ID: Hello_World_U8G2_SPI_Demo
- * Program by: Thesis Help
- * www.facebook.com/helpyouonurthesis
- *
- * Coode excerpt from U8g2
- * Copyright (c) 2012, olikraus@gmail.com
- * All rights reserved.
- * https://github.com/olikraus/u8g2
- *
- * LCD is a ST7920 128 x 64 Graphical. This piece of code
- * demonstrate using the LCD using the SPI bus. This means using only 3 pins in your
- * microcontroller.
- *
- */
- // Load the library,
- #include "U8g2lib.h"
- // setup u8g object, devices with all constructor calls is here:
- // https://github.com/olikraus/u8glib/wiki/device
- U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, 13, 11, 10, 8);
- void setup(void) {
- u8g2.begin();
- }
- void loop(void) {
- static int number = 0;
- char theNumber[8];
- itoa(number, theNumber, 10);
- // picture loop
- u8g2.firstPage();
- do {
- u8g2.drawFrame(102,10,20,25);
- u8g2.setFont(u8g2_font_ncenB18_tf);
- u8g2.drawStr(5, 20, "Hello");
- u8g2.drawStr(5, 43, "World!");
- u8g2.drawStr(105, 32, theNumber);
- u8g2.setFont(u8g2_font_6x10_tf);
- u8g2.drawStr(5,52, "www.facebook.com/");
- u8g2.drawStr(5,62, "helpyouonurthesis");
- } while( u8g2.nextPage() );
- number++;
- if (number > 9){
- number = 0;
- }
- // Some delay before redrawing.
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement