how to write Japanese characters ?

Hi everyone,

i am from Switzerland, 30 years old, and i have an arduino

i use it for my Daft punk helmet leds and i want to write Japanese characters but i dont know if it is possible and how to do it, i try writting it in my sketch but when i load it there is nothing showing in the leds...

i use the arduino 0.22.

do i have to check the options ?, is it the arduino itself ? do i need a special programm ?

Thanks

You may need to post your code and an example of what you're trying to do :slight_smile:

i am not a programmer, i use it because a friend told me how to use it, i am a real nub :grin:

here is what i use as a code :

void animationinfo(int animation,int *maxframes,int *loops,int *framestart,int *DISPDELAY,int *typeanimation,int background)
{switch(animation){ /
GG-DISPLAY */
case(0): //
*DISPDELAY=0;
*typeanimation=0;
msg=" TOKYO";
*background=1;
break;
i want to write the word "TOKYO" in japanese like this : ????? or ??.... but the problem is that i can save the sketch and upload it to my helmet and then ..nothing on the leds !

Making a data array for Katakana is as easy as for Roman letters or anything else.
Just plot out the points.

what do you mean to " plot out the points " :blush:

gilou:
what do you mean to " plot out the points " :blush:

Assuming this is an array of LEDs (I've never heard of "Daft punk"), you need determine which specific LEDs need to be on to form the shape of each Japanese character to be displayed. Then store that information for each character you want to display either in the flash memory or EEPROM. Once you have that you can write a function to convert a predetermined Latin alphabet a string to the proper Japanese characters and display them on the LED array.

oh my god... i can t do that

i am just a guy that use internet and emails, nothing else lol

here is the same model of the daft punk helmet that i have

is there nothing else more easy to do to write katakana :~

Link to the helmet?

As you can see it has LEDs on it. You would need to work out the bit-patterns (dots) for the Japanese characters and send those. Just as an example, the letter "I" is a vertical bar of LEDs.

the arduino is inside the helmet and connected to the leds.

for example , do i have to change something here :

*DISPDELAY=0;
*typeanimation=0;
msg=" TOKYO";
*background=1;
break;

or nothing to change here :~

i can show you all the code if you want, but i don t know if it can be useful

What I want you to do is post a link (hyperlink) to the helmet in question so we can see the datasheet, or other descriptions about how it works.

i can show you all the code if you want, but i don t know if it can be useful

There will be clues in the code as to how it works so post it all if you can. Looking at videos of a helmet in action and it can do most any types of LED pattern so probably not relying on fonts built into LED controller chips. Changing the font from Latin to Katakana should be possible.

i will post all the code later today. thanks everyone for your help :slight_smile:

here is the code ( half of it, i cant post more than 9500 words)

// comment out this line for the 8x32 display;
//#define 16x24

#include <WPROGRAM.H>
#include "ht1632.h"
#include <AVR/pgmspace.h>
#include "myfont.h"
#include "font3.h"

#ifdef 16x24
#define X_MAX 23
#define Y_MAX 15
#else
#define X_MAX 31
#define Y_MAX 7
#endif

//(fc) switched to a different set of pins than the original, to accomodate the SD shield;
#define HT1632_DATA 6 // Data pin (pin 7)
#define HT1632_WRCLK 7 // Write clock pin (pin 5)
#define HT1632_CS 8 // Chip Select (1, 2, 3, or 4)

#define plot(x,y,v) ht1632_plot(x,y,v)
#define cls ht1632_clear
int DISPDELAY=0;
int frame = 0;
int n=0;
int loops=0;
int maxframes=0;
int framestart=0;
int typeanimation=0;
char *msg="Hola Mundo";
int crtPos = 0;
int background=1;
int animCounter = 0; //(tek)
#define MAXANIMATIONS 14

// Read Resistance Values from Pin 2 (tek)
int potPin = 3; // select the input pin for the multi-position switch
int potVal = 0; // value of the potentiometer reading
int btnPos = 1; // position of the multi state button

void ht1632_chipselect(byte chipno)
{
DEBUGPRINT("\nHT1632(%d) ", chipno);
digitalWrite(chipno, 0);
}

void ht1632_chipfree(byte chipno)
{
DEBUGPRINT(" [done %d]", chipno);
digitalWrite(chipno, 1);
}
/*
*/
// (fc) covers the case for 32x8 as well (64 bytes, 4 bits)
byte ht1632_shadowram[96]; // our copy of the display's RAM
*/
void ht1632_writebits (byte bits, byte firstbit)
{
DEBUGPRINT(" ");
while (firstbit) {
DEBUGPRINT((bits&firstbit ? "1" : "0"));
digitalWrite(HT1632_WRCLK, LOW);
if (bits & firstbit) {
digitalWrite(HT1632_DATA, HIGH);
}
else {
digitalWrite(HT1632_DATA, LOW);
}
digitalWrite(HT1632_WRCLK, HIGH);
firstbit >>= 1;
}
}

/*

  • ht1632_sendcmd
  • Send a command to the ht1632 chip.
  • A command consists of a 3-bit "CMD" ID, an 8bit command, and
  • one "don't care bit".
  • Select 1 0 0 c7 c6 c5 c4 c3 c2 c1 c0 xx Free
    /
    static void ht1632_sendcmd (byte command)
    {
    ht1632_chipselect(HT1632_CS); // Select chip
    ht1632_writebits(HT1632_ID_CMD, 1<<2); // send 3 bits of id: COMMMAND
    ht1632_writebits(command, 1<<7); // send the actual command
    ht1632_writebits(0, 1); /
    one extra dont-care bit in commands. */
    ht1632_chipfree(HT1632_CS); //done
    }

*/
void ht1632_clear()
{
char i;

ht1632_chipselect(HT1632_CS); // Select chip
ht1632_writebits(HT1632_ID_WR, 1<<2); // send ID: WRITE to RAM
ht1632_writebits(0, 1<<6); // Send address
for (i = 0; i < 96/2; i++) // Clear entire display
ht1632_writebits(0, 1<<7); // send 8 bits of data
ht1632_chipfree(HT1632_CS); // done
for (i=0; i < 96; i++)
ht1632_shadowram = 0;
}
/*
*/
static void ht1632_senddata (byte address, byte data)
{

  • ht1632_chipselect(HT1632_CS); // Select chip*
  • ht1632_writebits(HT1632_ID_WR, 1<<2); // send ID: WRITE to RAM*
  • ht1632_writebits(address, 1<<6); // Send address*
  • ht1632_writebits(data, 1<<3); // send 4 bits of data*
  • ht1632_chipfree(HT1632_CS); // done*
    }
    void ht1632_setup()
    {
  • pinMode(HT1632_CS, OUTPUT);*
  • digitalWrite(HT1632_CS, HIGH); // unselect (active low)*
  • pinMode(HT1632_WRCLK, OUTPUT);*
  • pinMode(HT1632_DATA, OUTPUT);*
  • ht1632_sendcmd(HT1632_CMD_SYSDIS); // Disable system*
    #ifdef 16x24
    ht1632_sendcmd(HT1632_CMD_COMS11); // 16*32, PMOS drivers
    #else
    // (fc)
  • ht1632_sendcmd(HT1632_CMD_COMS10); // 32x8, PMOS drivers*
    #endif
  • ht1632_sendcmd(HT1632_CMD_MSTMD); // Master Mode*
  • ht1632_sendcmd(HT1632_CMD_SYSON); // System on*
  • ht1632_sendcmd(HT1632_CMD_LEDON); // LEDs on*
  • for (byte i=0; i<64; i++)*
  • ht1632_senddata(i, 0); // clear the display!*
  • delay(100); // ?*
    }
    /*
    */
    void ht1632_plot (int x, int y, char val)
    {
  • if (x<0 || x>X_MAX || y<0 || y>Y_MAX)*
  • return;*
  • char addr, bitval;*
    _ */_
  • bitval = 8>>(y&3); // compute which bit will need set*
    #ifdef 16x24
  • addr = (x<<2) + (y>>2); // compute which memory word this is in*
    #else
    // (fc)
  • addr = (x<<1) + (y>>2); // compute which memory word this is in*
    #endif
  • if (val) { // Modify the shadow memory*
  • ht1632_shadowram[addr] |= bitval;*
  • }*
  • else {*
  • ht1632_shadowram[addr] &= ~bitval;*
  • }*
  • // Now copy the new memory value to the display*
  • ht1632_senddata(addr, ht1632_shadowram[addr]);*
    }
    /*
    * get_shadowram
    * return the value of a pixel from the shadow ram.
    */
    byte get_shadowram(byte x, byte y)
    {
  • byte addr, bitval;*
  • bitval = 8>>(y&3); // compute which bit will need set*
  • addr = (x<<2) + (y>>2); // compute which memory word this is in*
  • return (0 != (ht1632_shadowram[addr] & bitval));*
    /*
    */
    void snapshot_shadowram()
    {
  • for (char i=0; i< sizeof ht1632_shadowram; i++) {*
    ht1632_shadowram = (ht1632_shadowram & 0x0F) | ht1632_shadowram << 4; // Use the upper bits
    byte get_snapshotram(byte x, byte y)
    {
    * byte addr, bitval;*
    * bitval = 128>>(y&3); // user upper bits!*
    #ifdef 16x24
    * addr = (x<<2) + (y>>2); // compute which memory word this is in*
    #else
    // (fc)
    * addr = (x<<1) + (y>>2); // compute which memory word this is in*
    #endif
    * if (ht1632_shadowram[addr] & bitval)
    _ return 1;
    return 0;
    }
    void ht1632_putchar(int x, int y, char c,int background)
    {
    // fonts defined for ascii 32 and beyond (index 0 in font array is ascii 32);
    byte charIndex;
    // replace undisplayable characters with blank;
    if (c < 32 || c > 126)
    {
    charIndex = 0;
    }
    else*

    * {
    charIndex = c - 32;
    }
    // move character definition, pixel by pixel, onto the display;
    // fonts are defined as one byte per row;
    for (byte row=0; row<8; row++)
    {_

    byte rowDots = pgm_read_byte_near(&font3[charIndex][row]);*

* for (byte col=0; col<6; col++)*
* {*
* if (rowDots & (1<<(5-col)))*
_ plot(x+col, y+row, 1background);
else*

plot(x+col, y+row, (1background+1)%2);
}
}
}
void animationinfo(int animation,int *maxframes,int *loops,int *framestart,int *DISPDELAY,int *typeanimation,int *background)
{switch(animation){ / GG-DISPLAY /
case(0): //
DISPDELAY=0;
typeanimation=0;
msg=" TOKYO";

background=1;
break;
case(1):*maxframes=62; //llena-vacia
DISPDELAY=0;
framestart=9;
loops=1;
typeanimation=1;
break;

case(2): //ROBOT HUMAN
DISPDELAY=0;
typeanimation=0;
msg=" ROBOT HUMAN";

background=1;
break;

case(3): //DAFT PUNK
DISPDELAY=0;
typeanimation=0;
msg=" DAFT PUNK";

background=1;
break;

case(4):*maxframes=9; //ecualizador
DISPDELAY=50;
framestart=0;
loops=5;
typeanimation=1;
break;

case(5):*maxframes=61; //kit
DISPDELAY=0;
framestart=106;
loops=2;
typeanimation=1;
break;

}}

/

This works equally well for both 16x24 and 8x32 matrices.

/

{
for(n=0;n<loops;n++)
{
for(frame=0;frame<maxframes;frame++)
{
for (byte row=0; row<32; row++)_

{ byte rowDots = pgm_read_byte_near(&myfont[frame+framestart][row]);*

* for (byte col=0; col<8; col++)*
* {*
* if (rowDots & (1<<(7-col)))*
* plot(row, col, 1);*
* else*
* plot(row, col, 0);*
* }*
* }*
* delay(DISPDELAY);*
}}}
else
{ while(1)
{
* // shift the whole screen 6 times, one column at a time; *
* for (int x=0; x < 6; x++) *
* { *
* ht1632_putchar(-x, 0, msg[crtPos],background);
ht1632_putchar(-x+6, 0, ((crtPos+1 < strlen(msg)) ? msg[crtPos+1] : ' '),background);
ht1632_putchar(-x+12, 0, ((crtPos+2 < strlen(msg)) ? msg[crtPos+2] : ' '),background);
ht1632_putchar(-x+18, 0, ((crtPos+3 < strlen(msg)) ? msg[crtPos+3] : ' '),background);
ht1632_putchar(-x+24, 0, ((crtPos+4 < strlen(msg)) ? msg[crtPos+4] : ' '),background);
ht1632_putchar(-x+30, 0, ((crtPos+5 < strlen(msg)) ? msg[crtPos+5] : ' '),background);
ht1632_putchar(-x+36, 0, ((crtPos+6 < strlen(msg)) ? msg[crtPos+6] : ' '),background);
_ delay(DISPDELAY);
} *_

* crtPos++; *
* if (crtPos >= strlen(msg)) *
* { *
crtPos = 0;
* break;*

Use code tags! Then you could post all your code without being limited by the maximum characters or the formatting being changed. To get code tags just click the little button with the "#" symbol on it.

some letters and numbers

define all ascii characters starting with 32 (blank);
unsigned char PROGMEM font3[95][8] = {
{
0x00, // ________ blank (ascii 32)
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0x00, // ________
0x00 // ________

},
#ifdef 16x24
{
0x00, // ________ 0
0x0C, // __XX
0x12, // __X__X
0x12, // __X__X
0x12, // __X__X
0x12, // __X__X
0x0C, // __XX
0x00, // ________
},
{

#else // 8x32
{
0x00, // ________ 0
0x1C, // _XXX
0x26, // _X__XX
0x26, // _X__XX
0x26, // _X__XX
0x26, // _X__XX
0x1C, // _XXX
0x00, // ________
},
{
0x00, // ________ 1
0x0C, // __XX
0x1C, // _XXX
0x2C, // X_XX
0x0C, // __XX
0x0C, // __XX
0x1E, // __XXXX
0x00, // ________
},
{
0x00, // ________ 2
0x1C, // _XXX
0x26, // _X__XX
0x0C, // XX
0x18, // XX
0x30, // XX

0x3E, // _XXXXX
0x00, // ________
},
{
0x00, // ________ 3
0x3E, // _XXXXX
0x06, // ____XX
0x1C, // _XXX
0x06, // ____XX
0x26, // _X__XX
0x1C, // _XXX
0x00, // ________
},
{
0x00, // ________ 4
0x26, // _X__XX
0x26, // _X__XX
0x3E, // _XXXXX
0x06, // ____XX
0x06, // ____XX
0x06, // ___XX
0x00, // ________
},
{
0x00, // ________ 5
0x3E, // XXXXX
0x30, // XX

0x3C, // XXXX
0x06, // ____XX
0x26, // X__XX
0x1C, // XXX
0x00, // ________
},
{
0x00, // ________ 6
0x1C, // XXX
0x20, // X

0x3C, // XXXX
0x26, // _X__XX
0x26, // _X__XX
0x1C, // _XXX
0x00, // ________
},
{
0x00, // ________ 7
0x3E, // _XXXXX
0x06, // ____XX
0x0C, // __XX
0x18, // XX
0x18, // XX
0x18, // XX
0x00, // ________
},
{
0x00, // ________ 8
0x1C, // _XXX
0x26, // _X__XX
0x1C, // _XXX
0x26, // _X__XX
0x26, // _X__XX
0x1C, // _XXX
0x00, // ________
},
{
0x00, // ________ 9
0x1C, // _XXX
0x26, // _X__XX
0x1E, // __XXXX
0x06, // ____XX
0x26, // _X__XX
0x1C, // _XXX
0x00, // ________
},
#endif
{
0x00, // ________ :
0x00, // ________
0x0C, // __XX
0x0C, // __XX
0x00, // ________
0x0C, // __XX
0x0C, // __XX
0x00, // ________
},

{
0x00, // ________ A
0x1C, // XXX
0x22, // X___X
0x22, // X___X
0x3E, // XXXXX
0x22, // X___X
0x22, // X___X
0x00 // ________
},
{
0x00, // ________ B
0x3C, // XXXX
0x22, // X___X
0x3C, // XXXX
0x22, // X___X
0x22, // X___X
0x3C, // XXXX
0x00 // ________
},
{
0x00, // ________ C
0x1C, // XXX
0x22, // X___X
0x20, // X

0x20, // X

0x22, // X___X
0x1C, // XXX
0x00 // ________
},
{
0x00, // ________ D
0x3C, // XXXX
0x22, // X___X
0x22, // X___X
0x22, // X___X
0x22, // X___X
0x3C, // XXXX
0x00 // ________
},
{
0x00, // ________ E
0x3E, // XXXXX
0x20, // X

0x3C, // XXXX
0x20, // X

0x20, // X

0x3E, // XXXXX
0x00 // ________
},
{
0x00, // ________ F
0x3E, // XXXXX
0x20, // X

0x3C, // XXXX
0x20, // X
_
0x20, // X___
0x20, // X___
0x00 // ________
},
{
0x00, // ________ G
0x1C, // XXX
0x20, // X
__
0x20, // X___
0x26, // _X__XX
0x22, // _X___X
0x1E, // __XXXX
0x00 // ________
},
{
0x00, // ________ H
0x22, // _X___X
0x22, // _X___X
0x3E, // _XXXXX
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x00 // ________
},
{
0x00, // ________ I
0x1C, // _XXX
0x08, // _X
0x08, // _X
0x08, // _X
0x08, // _X
0x1C, // _XXX
0x00 // ________
},
{
0x00, // ________ J
0x3E, // _XXXXX
0x02, // __X
0x02, // X
0x02, // X
0x22, // X___X
0x1C, // XXX
0x00 // ________
},
{
0x00, // ________ K
0x22, // X___X
0x24, // X__X
0x38, // XXX

0x38, // XXX

0x24, // X__X
0x22, // X___X
0x00, // ________
},
{
0x00, // ________ L
0x20, // X

0x20, // X

0x20, // X

0x20, // X

0x20, // X

0x3E, // _XXXXX
0x00, // ________
},
{
0x00, // ________ M
0x22, // _X___X
0x36, // _XX_XX
0x2A, // _X_X_X
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x00, // ________
},
{
0x00, // ________ N
0x22, // _X___X
0x32, // _XX__X
0x2A, // _X_X_X
0x26, // _X__XX
0x22, // X___X
0x22, // X___X
0x00, // ________
},
{
0x00, // ________ O
0x1C, // XXX
0x22, // X___X
0x22, // X___X
0x22, // X___X
0x22, // X___X
0x1C, // XXX
0x00, // ________
},
{
0x00, // ________ P
0x3C, // XXXX
0x22, // X___X
0x3C, // XXXX
0x20, // X

0x20, // X

0x20, // X

0x00, // ________
},
{
0x00, // ________ Q
0x18, // XX
0x24, // X__X
0x24, // X__X
0x24, // X__X
0x2C, // X_XX
0x1A, // __XX_X
0x00, // ________
},
{
0x00, // ________ R
0x3C, // XXXX
0x22, // _X___X
0x3C, // XXXX
0x22, // _X___X
0x22, // _X___X
0x22, // X___X
0x00, // ________
},
{
0x00, // ________ S
0x1E, // XXXX
0x20, // X

0x1C, // _XXX
0x02, // _____X
0x22, // _X___X
0x1C, // _XXX
0x00, // ________
},
{
0x00, // ________ T
0x3E, // _XXXXX
0x08, // _X
0x08, // _X
0x08, // _X
0x08, // _X
0x08, // _X
0x00, // ________
},
{
0x00, // ________ U
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x1C, // _XXX
0x00, // ________
},
{
0x00, // ________ V
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x14, // _X_X
0x14, // _X_X
0x08, // _X
0x00, // ________
},
{
0x00, // ________ W
0x22, // _X___X
0x22, // _X___X
0x22, // _X___X
0x2A, // _X_X_X
0x2A, // _X_X_X
0x14, // _X_X
0x00, // ________
},
{
0x00, // ________ X
0x22, // _X___X
0x14, // _X_X
0x08, // _X
0x08, // _X
0x14, // _X_X
0x22, // _X___X
0x00, // ________
},
{
0x00, // ________ Y
0x22, // _X___X
0x22, // _X___X
0x14, // _X_X
0x08, // _X
0x08, // _X
0x08, // _X
0x00, // ________
},
{
0x00, // ________ Z
0x3E, // _XXXXX
0x04, // X
0x08, // X
0x10, // X

0x20, // X

0x3E, // _XXXXX
0x00, // ________
},

{
0x00, // ________ ~ (ascii 126)
0x00, // ________
0x10, // X_
0x2A, // _X_X_X
0x04, // ___X
0x00, // ________
0x00, // ________
0x00 // ________
},

That is hard to read. You can post an attachment (see Additional Options) under the posting box. Attach your sketch to that please.

Once again, please post a link to where this helmet came from so we can look at its technical specs. Also a link to any datasheets you might have.

this helmet is a hand made, not something that you can buy !

i will try to post every code in a file.

time to sleep, here in switzerland it is 00h09

here is the code ( half of it, i cant post more than 9500 words)

XD

Your helmet has been programmed to display the latin character set 0....9 A....Z.

First check you can get the helmet to work the way it was intended.
Without any changes can you get it to display the numbers;
012345

How many digits can it display at once?
How many LEDs make up each character?

When you have it working normally look at where the LED pattern for '0' is defined and change the pattern a little.
Then when you write a '0' to your helmet you will get the slightly altered pattern instead.
Now you need to change the pattern completely so that when you write a '0' you see ? instead.

Here is how the patterns work, you are going to have to get be able to convert decimal numbers into binary and hexadecimal but it is not really that hard;

    0x00,    // ________   0
    0x01,    // _______X   1
    0x02,    // ______X_   2
    0x03,    // ______XX   3
    0x04,    // _____X__   4
    0x05,    // _____X_X   5
    0x06,    // _____X_X   6
    0x07,    // _____XXX   7
    0x08,    // ____X___   8
    0x09,    // ____X__X   9
    0x0A,    // ____X_X_  10
    0x0B,    // ____X_XX  11
    0x0C,    // ____XX__  12
    0x0D,    // ____XX_X  13
    0x0E,    // ____XXX_  14
    0x0F,    // ____XXXX  15
    0x010,   // ___X____  16
    0x011,   // ___X___X  17

      :
      :
     and so on

The left hand column is a hexadecimal number (base 16).
The pattern is the same number in binary (base 2) where the X is a 1 and the _ is a 0.
The right hand column is the same number in decimal (base 10)

You use the above patterns to form a character like ?