added several examples to the Arduino release, issue #216

This commit is contained in:
olikraus 2017-05-14 11:07:41 +02:00
parent b1f83287fc
commit e8f15b7fd4
9 changed files with 42 additions and 18 deletions

View File

@ -112,5 +112,5 @@ https://github.com/olikraus/u8g2 ChangeLog
* Added setBitmapMode (pull request 220)
Warning: Default behavior of drawXBM has changed in this release.
* Increased SPI speed to 8MHz for SSD1306, SH1106 and SSD1322 (issue 215)
* Added some more examples (issue 216)

View File

@ -1,6 +1,9 @@
/*
HelloWorld.ino
Clock.ino
Demonstrates a clock-like display with a very huge font.
Also shows usage of u8x8_u8toa().
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
@ -182,7 +185,7 @@ uint8_t m = 24;
void loop(void) {
char m_str[3];
strcpy(m_str, u8x8_u8toa(m, 2));
strcpy(m_str, u8x8_u8toa(m, 2)); /* convert m to a string with two digits */
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_logisoso62_tn);

View File

@ -269,7 +269,7 @@
//U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7920_128X64_1_HW_SPI u8g2(U8G2_R0, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM132_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE); // DOGM132 Shield
//U8G2_ST7565_EA_DOGM132_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE); // DOGM132 Shield
//U8G2_ST7565_ZOLEN_128X64_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);

View File

@ -118,7 +118,7 @@
//U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7920_128X64_1_HW_SPI u8g2(U8G2_R0, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_ST7565_EA_DOGM132_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE); // DOGM132 Shield
//U8G2_ST7565_EA_DOGM132_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE); // DOGM132 Shield
//U8G2_ST7565_ZOLEN_128X64_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);

View File

@ -2,6 +2,10 @@
PowerSaveTest.ino
This test will turn on and off your display for two seconds.
If the text "power off" is visible on your display, then power save mode
does not work with your display.
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2016, olikraus@gmail.com
@ -43,11 +47,6 @@
#include <Wire.h>
#endif
/*
Preconditions:
Uno with DOGS102 Shield
*/
// Please UNCOMMENT one of the contructor lines below
// U8g2 Contructor List (Picture Loop Page Buffer)
// The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
@ -164,14 +163,10 @@ void draw(const char *s)
delay(2000);
}
void loop(void) {
u8g2.setPowerSave(0);
draw("power on");
u8g2.setPowerSave(1);
draw("power off");
}

View File

@ -2,6 +2,9 @@
ScrollingText.ino
This will scroll text on the display.
Enable U8g2 16 bit mode (see FAQ) for larger text!
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2016, olikraus@gmail.com

View File

@ -1,6 +1,10 @@
/*
HelloWorld.ino
XBM.ino
This will display a XBM image (generated by GIMP).
The .xbm file was pasted directly into the .ino file and moved to
flash (PROGMEM) area.
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
@ -153,7 +157,7 @@
// XBM file start
// XBM file start, paste the content of the XBM file directly into the .ino file
// variable name changed from
// static unsigned char u8g2_logo_97x51_bits[]
// to

View File

@ -1,6 +1,10 @@
/*
XORTest.ino
Shows solid and transparent font modes with XOR draw.
Conclusion: Only use transparent font modes with XOR draw.
This example also demonstrates scrolling.
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
@ -159,7 +163,7 @@ void testXOR(uint8_t x)
u8g2.firstPage();
do {
/* Solid mode with XOR drawing: Does not make much sense */
/* Solid font mode with XOR drawing: Does not make much sense */
u8g2.setFontMode(0);
u8g2.setDrawColor(1);
u8g2.drawBox(10, 8, 10, 10);
@ -170,7 +174,7 @@ void testXOR(uint8_t x)
u8g2.drawStr(x,26, "XOR Test");
u8g2.drawHLine(0, 29, 128);
/* Transparent mdoe with XOR drawing: looks good */
/* Transparent font mode with XOR drawing: looks good */
u8g2.setFontMode(1);
u8g2.setDrawColor(1);
u8g2.drawBox(10, 8+32, 10, 10);

View File

@ -55,6 +55,20 @@ cp ../../../sys/arduino/u8g2_page_buffer/SelectionList/*.ino ../../../../U8g2_Ar
mkdir ../../../../U8g2_Arduino/examples/page_buffer/GraphicsTest
cp ../../../sys/arduino/u8g2_page_buffer/GraphicsTest/*.ino ../../../../U8g2_Arduino/examples/page_buffer/GraphicsTest/.
mkdir ../../../../U8g2_Arduino/examples/page_buffer/Clock
cp ../../../sys/arduino/u8g2_page_buffer/Clock/*.ino ../../../../U8g2_Arduino/examples/page_buffer/Clock/.
mkdir ../../../../U8g2_Arduino/examples/page_buffer/XORTest
cp ../../../sys/arduino/u8g2_page_buffer/XORTest/*.ino ../../../../U8g2_Arduino/examples/page_buffer/XORTest/.
mkdir ../../../../U8g2_Arduino/examples/page_buffer/XBM
cp ../../../sys/arduino/u8g2_page_buffer/XBM/*.ino ../../../../U8g2_Arduino/examples/page_buffer/XBM/.
mkdir ../../../../U8g2_Arduino/examples/page_buffer/PowerSaveTest
cp ../../../sys/arduino/u8g2_page_buffer/PowerSaveTest/*.ino ../../../../U8g2_Arduino/examples/page_buffer/PowerSaveTest/.
# games
mkdir ../../../../U8g2_Arduino/examples/games/LittleRookChess
cp ../../../sys/arduino/u8g2_page_buffer/LittleRookChess/*.ino ../../../../U8g2_Arduino/examples/games/LittleRookChess/.
@ -129,6 +143,7 @@ sed -i -e "s/version=.*/version=${ver}/" library.properties
cd ..
echo "== create local zip file =="
pwd
rm u8g2_arduino_${ver}.zip
zip -q -r --exclude="*.git*" u8g2_arduino_${ver}.zip ./U8g2_Arduino
cp u8g2_arduino_${ver}.zip ~/Arduino/libraries/.