Show Posts
Pages: [1]
1  Products / Arduino Due / Re: Due support for Nokia 6100 display on: January 29, 2013, 02:54:40 pm
Hi,

Thanks for the quick reply. I started to work today on the code and just realized that graphic.print() doesn't handle float numbers. I'm reading the value from DS18B20. Finally I multiplied the temperature reading and put into an array digit by digit, and put the decimal point while printing out the digits separately. Than I had to solve the positioning issues, to keep the value at the same place regardless how many digits were printed, I dealt with the minus sign also. It was hard work, the code a bit complicated, there must be a more elegant was to do this, but I'm happy with it. Sorry if it isn't formatted and commented well, I'm new to programming.

I would like to add a button to navigate through different pages, with an interrupt to increment the "item" variable of switch case. To erase the previous page I draw a white box before printing the new data. This makes a little slow to navigate through the pages, I will try to erase the rows with "spaces" only.

Is there any way to send custom bitmaps to the display? I mean a snowflake for example when the temperature is below freezing.


Code:
switch(item)

{
  case 1:
  graphic.setCoordinate(5,5);
  graphic.print("case 1");
sensors.requestTemperatures(); // Send the command to get temperatures
temp= (int)(sensors.getTempCByIndex(0)*10);

sprintf(array, "%i", temp);
 

if (temp>=0 && temp<10) { 
    graphic.setCoordinate(temp_pos,temp_posY);
  graphic.print("  ");
  temp_pos +=12*size_factor;

     
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print("0.");
      temp_pos += 12*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[0]);
      temp_pos=temp_posX;
  }
 
if (temp>=10 && temp<100) {
 
  graphic.setCoordinate(temp_pos,temp_posY);
  graphic.print("  ");
  temp_pos += 12*size_factor;
  graphic.setCoordinate(temp_pos,temp_posY);
  graphic.print(array[0]);
  temp_pos += 6*size_factor;
  graphic.setCoordinate(temp_pos,temp_posY);
  graphic.print(".");
  temp_pos += 6*size_factor;
  graphic.setCoordinate(temp_pos,temp_posY);
  graphic.print(array[1]);
  temp_pos=temp_posX;
}

if (temp>=100)
    {
     graphic.setCoordinate(temp_pos,temp_posY);
  graphic.print("  ");
      temp_pos += 6*size_factor;
      for (int a=0; a<=1;a++){
       graphic.setCoordinate(temp_pos,temp_posY);
       graphic.print(array[a]);
       temp_pos += 6*size_factor;
       }
       graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(".");
      temp_pos += 6*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[2]);
      temp_pos=temp_posX;
    }
   

if (temp<0 && temp>-10)

  { 
graphic.setCoordinate(temp_pos,temp_posY);
graphic.print(" ");
  temp_pos += 6*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[0]);
      temp_pos += 6*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print("0.");
      temp_pos += 12*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[1]);
      temp_pos=temp_posX;
  }
    if (temp<-10 && temp>-100)
  { 
graphic.setCoordinate(temp_pos,temp_posY);
graphic.print(" ");
temp_pos+=6;
graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[0]);
      temp_pos += 6*size_factor;
     graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[1]);
      temp_pos += 6*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(".");
      temp_pos += 6*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[2]);
     
      temp_pos=temp_posX;
  }
 
 if (temp<=-100)
      {
      for (int a=0; a<=2;a++){
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[a]);
      temp_pos += 6*size_factor;
      }
     
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(".");
      temp_pos += 6*size_factor;
      graphic.setCoordinate(temp_pos,temp_posY);
      graphic.print(array[3]);
      temp_pos=temp_posX;
    }
2  Products / Arduino Due / Re: Due support for Nokia 6100 display on: January 27, 2013, 02:05:34 pm
Dear Tom,

Your library is awesome, but I have a little problem. I want to display continuously changing values, basically numbers. For example I put the cursor to 0,0 and print 1234 value, but if the value changes to three digits, 234, the last digit stays on the display. The number on the display 2344 instead of 234.

Another example, I put some text on the display, but when I print something shorter on the same place, the original text stays on.
The graphic.Clear() is so slow, I also tried to "overwrite" the area with a white box, but it flickers. I read 12 fps in earlier posts, 3-4 would be more than enough for me. I'm using mega board. I have LCD with Philips controller and use this code:

gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED); //High speed

What do you suggest to clear the previous information from the screen, and quickly update it?

Thanks
Pages: [1]