Req: Display two pages of data alternately using U8glib


hi

i need use u8glib display output of routine controlled loop variable 'param'.
'param' cycles 0 7 , determines various picture elements (e.g. bitmaps) displayed.
when param = 2, want display first page of data; pause 1 sec.
when param = 7, want display second page of data, pause 1 sec.
then continue loop endlessly.

despite following tutorials , reading forums, i've been unable find construct based around u8glib's 'draw' loop enable me display data in way.

as required u8glib, original routine in 'for' loop controlled loop variable 'param'; i've made 'for' loop function 'void draw(int param)', called 'draw' loop within main loop; , cycling value of 'param' within 'draw' loop.

the code below display first page correctly if second 'for' loop commented out; otherwise displays both first , second pages simultaneously (i.e. superimposed/overlapping).

however, try might, can't find way show 2 pages alternately.

i'd grateful if show me how construct 'draw' loop achieve above effect.

many in anticipation


dave

code: [select]

void loop(void)
{
  // picture loop

  u8g.firstpage();   
  {
    for(int param = 0;param<3;param++)//  draw elements first page:
    { 
      draw(param);
    }
    if (param == 2) // when elements first page drawn, pause display 1 sec
    {
      delay(1000);
    }

    for(int param = 3;param<8;param++) //  draw elements second page:
    { 
      draw(param);
    }
    if (param == 7) // when elements second page drawn, pause display 1 sec
    {
      delay(1000);
    }


  }
  while( u8g.nextpage() );//end of picture loop

} // end of void loop

hi dave

first need group procedures according needs displayed on 1 page.
for first page, seems be:
draw(0);
draw(1);
draw(2);

i suggest introduce procedure (to simplify code):
code: [select]
void draw_page_1(void)
{
draw(0);
draw(1);
draw(2);
}

of course still use param loop.
same should done draw_page_2()

second, delay , different pages must selected/switched outside picture loop.
this might this:

code: [select]
  u8g.firstpage();   
  {
   draw_page_1();
  }
  while( u8g.nextpage() );//end of picture loop
  delay(1000);
  u8g.firstpage();   
  {
   draw_page_2();
  }
  while( u8g.nextpage() );//end of picture loop


oliver



Arduino Forum > Using Arduino > Displays > Req: Display two pages of data alternately using U8glib


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support