U8g2: Unicode example and Arduboy

Created on 25 Apr 2018  Â·  14Comments  Â·  Source: olikraus/u8g2

Hi @olikraus
Thanks for share this fantastic library, My question is:
Why are not any Unicode examples working on Arduboy?
After successful code uploads, the Arduboy screen is black and nothing is displayed. (Other examples work!)
My Arduino version : 1.8.3

Regards,
Ramin

All 14 comments

Arduboy should just work as any other Arduino Board. Maybe share your code here?

I used the existing examples. for example :

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6);   // Arduboy (Production, Kickstarter Edition)

void setup(void) {

  /* U8g2 Project: SSD1306 Test Board */
  //pinMode(10, OUTPUT);
  //pinMode(9, OUTPUT);
  //digitalWrite(10, 0);
  //digitalWrite(9, 0);     

  /* U8g2 Project: T6963 Test Board */
  //pinMode(18, OUTPUT);
  //digitalWrite(18, 1);    

  u8g2.begin();  
}

const uint16_t my_kerning_table[] = 
{
    /* first char, second char, gap reduction value */
    0x646, 0x627, 4, /* ن and ا */
    0x627, 0x647, 5, /* ا and ه */
    0x647, 0x62C, 6, /* ه and ج */


    0x645, 0x627, 3, /* م and ا */
    0x627, 0x644, 4, /* ا and ل */
    0x644, 0x633, 2, /* ل and س */

    /* this line terminates the table */
    0xffff, 0xffff, 0xffff
};

void loop(void) {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_unifont_t_arabic);

    u8g2.drawExtUTF8(120, 15, 1, NULL, "سلام جهان");    /* Hello World */
    u8g2.drawExtUTF8(120, 30, 1, my_kerning_table, "سلام جهان");    /* Hello World */
  } while ( u8g2.nextPage() );
  //delay(1000);
}

Other unicode example (+) not work and screen is Black !

I am confused. What exactly works and what does not work?

The Example above works.

This Example does not work:
https://github.com/olikraus/u8g2/blob/master/sys/arduino/u8g2_page_buffer/Korean/Korean.ino

Is this what you say?

Both do not work and after successful uploads, screen is black.

U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6);

does software SPI work?

I used my own SSD1306 and it does not work on HW mode too, but I'm not sure if this is the case with other boards.

@RobotGB
Thanks, on Arduboy Software SPI does not work !

What would happen if, instead of "سلام جهان", you put "x0633x0644x0627x0645x0020x062Cx0647x0627x0646"?

@RobotGB
Output :
u8g2.drawExtUTF8(120, 15, 1, NULL, "\x0633\x0644\x0627\x0645\x0020\x062C\x0647\x0627\x0646");

img_20180425_233949

Another interesting case
Korean.ino file output :

photo_2018-04-25_23-46-17

U8g2 comes with the ExtUTF8 example (page buffer section) which should be exactly the example which you have posted.

ExtUTF8 example works as expected for me on my Arduboy

img_20180425_223523

I could imagine, that you Arduino IDE is not in UTF8 mode. Or you did not use Arduino IDE but something else?
What tool did you use to download your .ino file? Did you use Arduino IDE?

@olikraus
I use Arduino v1.8.3

Then... I don't know....

Thanks @olikraus

This is the U8g2 Project. I can try to help with U8g2 related problems. As we discussed, the U8g2 Arabic example works for me, so I hope it will work for you also.

I can not debug/analyse/review other programs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Robiv8 picture Robiv8  Â·  5Comments

mkovero picture mkovero  Â·  5Comments

luebbe picture luebbe  Â·  5Comments

idreamsi picture idreamsi  Â·  7Comments

walenw picture walenw  Â·  8Comments