Touchscreen while Schleife


hi zusammen,

ich bin noch recht ne hier, daher vergebt mir wenn ich mich der ein oder anderen stelle nicht korrekt ausdrücke.

ich habe ein 2,8" touchscreen display, ich auch zum laufen gebracht habe.

zum aufbau:

ich habe 4 "touch buttons":

min+
sec+
cancel
start

mit min+ und sec+ wird ein timer eingestellt. mit cancel alles auf null gesetzt und mit start gehts los.

für den countdown habe ich die countimer.h lib genutzt. ich bekomme auch der countdown im seriellen monitor angezeigt wie er runtertickt aber nicht auf dem display.....und das liegt glaube ich daran, dass ich in der while schleife festhänge.........

hieraus folgt dann auch mein zweites problem..... wenn der countdown abgelaufen ist kann ich keine eingaben mehr machen außer den countdown neu zu starten. vielleicht kann mir jemand nen tip geben.


code: [select]
[code]

#include <utft.h>
#include <urtouch.h>
#include <utft_buttons.h>
#include "countimer.h"
int seconds = 0;
int minutes = 0;
countimer exptime;

extern uint8_t smallfont[];
extern uint8_t bigfont[];
extern uint8_t sevensegnumfont[];


utft          myglcd(itdb28,a5,a4,a3,a2);
urtouch        mytouch(a1,a3,a0,8,9);

utft_buttons  mybuttons(&myglcd, &mytouch);

void setup()
{
  myglcd.initlcd();
  myglcd.clrscr();
  mytouch.inittouch();
  mytouch.setprecision(prec_medium);
  mybuttons.settextfont(bigfont);
}

void loop()

{
  int but1, but2, but3, but4, pressed_button;
  boolean default_colors = true;
 
  but1 = mybuttons.addbutton( 10,  180, 90,  50, "min +");
  but2 = mybuttons.addbutton( 110,  180, 90,  50, "sec +");
  but3 = mybuttons.addbutton( 210, 180, 101,  50, "cancel");
  but4 = mybuttons.addbutton( 210, 10, 101,  160, "start");


 
  mybuttons.drawbuttons();

  while(1)
 {
  myglcd.setfont(bigfont);
   exptime.run();
   exptime.setinterval(print_time2, 1000);
      myglcd.print(exptime.getcurrenttime(),0,0);
    if (mytouch.dataavailable() == true)
    {
      pressed_button = mybuttons.checkbuttons();
      if (pressed_button==but1){
           minutes ++;
           myglcd.setfont(sevensegnumfont);
           myglcd.printnumi(minutes,40,40,2,'0');
           myglcd.setfont(sevensegnumfont);
           myglcd.printnumi(seconds,114,40,2,'0');
      }
      if (pressed_button==but2)
      {
        seconds ++;
           myglcd.setfont(sevensegnumfont);
           myglcd.printnumi(minutes,40,40,2,'0');
           myglcd.setfont(sevensegnumfont);
           myglcd.printnumi(seconds,114,40,2,'0');
 
      }
      if (pressed_button==but3)
      {
        seconds=0;
       minutes=0;
           myglcd.setfont(sevensegnumfont);
           myglcd.printnumi(minutes,40,40,2,'0');
           myglcd.setfont(sevensegnumfont);
           myglcd.printnumi(seconds,114,40,2,'0');
      }
      if (pressed_button==but4)
      {
      exptime.setcounter(0, minutes, seconds, exptime.count_down, exptimecomplete);
      // call print_time2() method every 1s.
      exptime.start();
      myglcd.setfont(bigfont);
      exptime.setinterval(print_time2, 1000);
      myglcd.print(exptime.getcurrenttime(),0,0);
   
      }
      if (pressed_button==-1)
      {
      }
    }
  }
}

void print_time2()
{
  serial.begin(9600);
  serial.print("tdown: ");
  serial.println(exptime.getcurrenttime());
  //myglcd.clrscr();
  myglcd.setfont(bigfont);
 
  myglcd.print("test",0,0);
}
void exptimecomplete()
{
}

[/code]

tipp ....  :)

na ja, der fehler ist wohl hier:
quote
"
"
"
but4 = mybuttons.addbutton( 210, 10, 101,  160, "start");
mybuttons.drawbuttons();

while(1)   <<<<<<<<<  while(1) == while(true) == "mache für alle zeiten nur noch dieses..."
{
  myglcd.setfont(bigfont);
  exptime.run();
  exptime.setinterval(print_time2, 1000);
"
"
"
nirgends 'n "break" oder sonst etwas, dich aus der schleife heraus leitet...

zum beispiel:
quote
if( "bedingung" == "erledigt")
  { break; }
oder ähnlich
lg, rudi


Arduino Forum > International > Deutsch (Moderator: uwefed) > Touchscreen while Schleife


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'