Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: passing a char array on: October 22, 2012, 04:22:17 pm
Thanks to you guys I've fabricated something that works (for 95%).
I can now show some text on my 3310 nokia lcd screen.
There is still a weird sign at the end of the text, and I don't know how to delete that last caracter.
If someone has an idea in what I'm doing wrong, please comment.

Greetings, Jeroen
2  Using Arduino / Programming Questions / passing a char array on: October 10, 2012, 11:56:15 am
Hi!

I'm trying to do some LCD stuff, and for that I need a little routine to cut a string into pieces depending of the with of each character.
Since I can't find a lib with "text clipping" and "var width fonts", I'm trying to make something myself.

I wrote some code, and it's working fine, but I can't put it into a function. Can someone help me?

Code:
static int lengte[] = {
3, 1, 3, 5, 5, 5, 5, 2, 3, 3, 5, 5, 2, 5, 2, 5, //20,21,22,23,24,25,26,27,28,29,2a,2b,2c,2d,2e,2f
5, 3, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 4, 5, 4, 5, //30,31,32,33,34,35,36,37,38,39,3a,3b,3c,3d,3e,3f
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //40,41,42,43,44,45,46,47,48,49,4a,4b,4c,4d,4e,4f
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 5, 3, 5, 5, //50,51,52,53,54,55,56,57,58,59,5a,5b,5c,5d,5e,5f
3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 3, 4, 3, 4, 4, 4, //60,61,62,63,64,65,66,67,68,69,6a,6b,6c,6d,6e,6f
4, 4, 4, 4, 4, 4, 5, 5, 5, 3, 3, 3, 1, 3, 5, 5, //70,71,72,73,74,75,76,77,78,79,7a,7b,7c,7d,7e,7f
};

char *FormatString(String Vtext) {

  #define LCDWIDTH   84
  int Vlengthtext=0;
  int Vprevlengthtext=0;
  char Vtext2[100]="";
  char *Vtexttoprint[200];
  int j=0;
  int k=0;
 
  for (int i=0; i<=Vtext.length();i++){
    Vtext2[k] = Vtext.charAt(i);
    k++;
    Vlengthtext = Vlengthtext + lengte[Vtext.charAt(i) - 0x20];
    if ((Vprevlengthtext <= LCDWIDTH*(1+j) && Vlengthtext > LCDWIDTH*(1+j)) || i==Vtext.length()){
      Vtexttoprint[j]=Vtext2;
      memset(Vtext2,0,sizeof(Vtext2));//for (int z=0; z<100;z++){Vtext2[z]=0;}
      k=0;
      j++;
    } else{
      Vprevlengthtext=Vlengthtext;
    }
  }
   
  return (Vtexttoprint); 
}



void setup(void){
}

void loop(void){
 
  for (int k = 0; k < 1; k++) {
    Serial.begin(9600);
    Serial.println(FormatString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"))
    ;delay(100);
  }
    delay(10000);

}


Thanks,

Jeroen
3  Using Arduino / Displays / Re: Variable width font on a nokia 3310 LCD on: October 04, 2012, 02:46:45 pm
Thanks!

Do you maybe know if it's possible to start at a new line when the text has reached the right end of the screen?

Jeroen
4  Using Arduino / Displays / Variable width font on a nokia 3310 LCD on: October 04, 2012, 01:51:02 pm
Hi!

I just arrived in the Arduino world, I played around a bit to get used to it and now here I'm with my first post.

I'm trying to do some stuff with a nokia 3310 LCD screen I've got from ebay. I got the screen running just a few hours after I got it thanx to some sample code. http://www.arduino.cc/playground/Code/PCD8544

Now, since I want to display a lot of text on the screen, I want to use variable with fonts... I've been looking for ages for some simple effective code to do so, but I can't find any. For more than a month now, I'm trying to write my own code, but I can't create something useful.

Is there someone who can help me with this?

Thanks a lot!
Pages: [1]