Search code examples
c#led

How to write a program to convert text to hex code for led moving sign


Hello

sorry, my english is bad :|

I want to write a program to convert text to hex code for led moving sign

How do I scan text in the text box pixel by pixel and get its hex code.

The only way is to my mind is that I convert text to image then I scan image and find it's on and off points.

What is your suggestion ? Is there an easier way?How to convert text to image?

NOTE: I want this program to be responsive for all sizes

this is an example for this program

hex code of 'test' in 32*16

const unsigned char Code[]=
{

0x00,0x20,  //  X=32

0x00,0x10,  //  Y=16

0x00,0x10,  //  ...........#....

0x00,0x10,  //  ...........#....

0x00,0x10,  //  ...........#....

0x1F,0xF0,  //  ...#########....

0x00,0x10,  //  ...........#....

0x00,0x10,  //  ...........#....

0x00,0x10,  //  ...........#....

0x00,0x00,  //  ................

0x0F,0x80,  //  ....#####.......

0x12,0x40,  //  ...#..#..#......

0x12,0x40,  //  ...#..#..#......

0x12,0x40,  //  ...#..#..#......

0x12,0x40,  //  ...#..#..#......

0x0B,0x80,  //  ....#.###.......

0x00,0x00,  //  ................

0x09,0x80,  //  ....#..##.......

0x12,0x40,  //  ...#..#..#......

0x12,0x40,  //  ...#..#..#......

0x12,0x40,  //  ...#..#..#......

0x0C,0x80,  //  ....##..#.......

0x00,0x00,  //  ................

0x00,0x40,  //  .........#......

0x0F,0xF0,  //  ....########....

0x10,0x40,  //  ...#.....#......

0x10,0x40,  //  ...#.....#......

0x00,0x00,  //  ................

0x00,0x00,  //  ................

0x00,0x00,  //  ................

0x00,0x00,  //  ................

0x00,0x00,  //  ................

0x00,0x00,  //  ................

0x00,0x00   //  ................

};

Solution

  • To get you going:

    string test = "abc123"; foreach (var character in test) string.Format("{0:X}", (int)character);