output pins richtig deklarieren

hi

meine outputpins sind deklariert nur werden sie immer alles zusammen ein und ausgeschaltet

#include <UTFT.h>
#include <ITDB02_Touch.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int Relais6 = 13;
int Relais5 = 12;
int Relais4 = 11;
int Relais3 = 10;
int Relais2 = 9;
int Relais1 = 8;

// Uncomment the next line for Arduino 2009/Uno
//UTFT myGLCD(ITDB32S,19,18,17,16);   // Remember to change the model parameter to suit your display module!
//ITDB02_Touch  myTouch(15,10,14,9,8);

// Uncomment the next line for Arduino Mega
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!
ITDB02_Touch  myTouch(6,5,4,3,2);

int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";

void setup()
{
// Initial setup
  myGLCD.InitLCD(LANDSCAPE);
  myGLCD.clrScr();

  myTouch.InitTouch(LANDSCAPE);
  myTouch.setPrecision(PREC_MEDIUM);

  myGLCD.setFont(SmallFont);
  //myGLCD.setBackColor(0, 0, 255);

// initialize the digital pin as an output.
  pinMode(Relais6, OUTPUT);
  pinMode(Relais5, OUTPUT); 
  pinMode(Relais4, OUTPUT);
  pinMode(Relais3, OUTPUT);
  pinMode(Relais2, OUTPUT);
  pinMode(Relais1, OUTPUT);

könnt ihr mir dazu bitte helfen

Poser:
hi
meine outputpins sind deklariert nur werden sie immer alles zusammen ein und ausgeschaltet
...
könnt ihr mir dazu bitte helfen

Und wo im Sketch werden die Ausgänge gesetzt? Bitte den ganzen Sketch.
Grüße Uwe

Hi,
so wie ich das sehe, hast du sie zwar deklariert, aber du hast in deinem Programm keine Bedingung wie du sie einzeln ansteuern willst.
Somit werden Sie alle auf einmal geschaltet.

#include <UTFT.h>
#include <ITDB02_Touch.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int Relais6 = 13;
int Relais5 = 12;
int Relais4 = 11;
int Relais3 = 10;
int Relais2 = 9;
int Relais1 = 8;

// Uncomment the next line for Arduino 2009/Uno
//UTFT myGLCD(ITDB32S,19,18,17,16);   // Remember to change the model parameter to suit your display module!
//ITDB02_Touch  myTouch(15,10,14,9,8);

// Uncomment the next line for Arduino Mega
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!
ITDB02_Touch  myTouch(6,5,4,3,2);

int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";

void setup()
{
// Initial setup
  myGLCD.InitLCD(LANDSCAPE);
  myGLCD.clrScr();

  myTouch.InitTouch(LANDSCAPE);
  myTouch.setPrecision(PREC_MEDIUM);

  myGLCD.setFont(SmallFont);
  //myGLCD.setBackColor(0, 0, 255);

// initialize the digital pin as an output.
  pinMode(Relais6, OUTPUT);
  pinMode(Relais5, OUTPUT); 
  pinMode(Relais4, OUTPUT);
  pinMode(Relais3, OUTPUT);
  pinMode(Relais2, OUTPUT);
  pinMode(Relais1, OUTPUT);

  
  
// Draw the upper row of buttons
  for (x=0; x<6; x++);
    {
  myGLCD.setBackColor (0, 0, 255);
  myGLCD.setColor(255, 255, 255);
  myGLCD.print("BAD", 10, 20);
  myGLCD.fillRoundRect (190, 15, 240, 40);
  myGLCD.drawRoundRect (190, 15, 240, 40);
  myGLCD.print("ON", 200, 20);
  myGLCD.fillRoundRect (250, 15, 300, 40);
  myGLCD.drawRoundRect (250, 15, 300, 40);  
  myGLCD.print("OFF", 250, 20);
  myGLCD.print("KUECHE", 10, 60);
  myGLCD.fillRoundRect (190, 55, 240, 80);
  myGLCD.drawRoundRect (190, 55, 240, 80);
  myGLCD.print("ON", 200, 60);
  myGLCD.fillRoundRect (250, 55, 300, 80);
  myGLCD.drawRoundRect (250, 55, 300, 80);
  myGLCD.print("OFF", 250, 60);
  myGLCD.print("WOHN", 10, 100);
  myGLCD.fillRoundRect (190, 95, 240, 120);
  myGLCD.drawRoundRect (190, 95, 240, 120);
  myGLCD.print("ON", 200, 100);
  myGLCD.fillRoundRect (250, 95, 300, 120);
  myGLCD.drawRoundRect (250, 95, 300, 120);
  myGLCD.print("OFF", 250, 100);
  myGLCD.print("POOL", 10, 140);
  myGLCD.fillRoundRect (190, 135, 240, 160);
  myGLCD.drawRoundRect (190, 135, 240, 160);
  myGLCD.print("ON", 200, 140);
  myGLCD.fillRoundRect (250, 135, 300, 160);
  myGLCD.drawRoundRect (250, 135, 300, 160);
  myGLCD.print("OFF", 250, 140);
  myGLCD.print("RADIO", 10, 180);
  myGLCD.fillRoundRect (190, 175, 240, 200);
  myGLCD.drawRoundRect (190, 175, 240, 200);
  myGLCD.print("ON", 200, 180);
  myGLCD.fillRoundRect (250, 175, 300, 200);
  myGLCD.drawRoundRect (250, 175, 300, 200);
  myGLCD.print("OFF", 250, 180);
  myGLCD.print("LEER", 10, 220);
  myGLCD.fillRoundRect (190, 215, 240, 239);
  myGLCD.drawRoundRect (190, 215, 240, 239);
  myGLCD.print("ON", 200, 220);
  myGLCD.fillRoundRect (250, 215, 300, 239);
  myGLCD.drawRoundRect (250, 215, 300, 239);
  myGLCD.print("OFF", 250, 220);
 
  }
  //myGLCD.print("0", 267, 87);
 //Draw the lower row of buttons
 for (x=0; x<5; x++)
  myGLCD.setBackColor (0, 0, 255);
  myGLCD.setColor(255, 255, 255);
  myGLCD.fillRoundRect (250, 15, 300, 40);
  myGLCD.drawRoundRect (250, 15, 300, 40);  
  myGLCD.print("OFF", 250, 20);
  myGLCD.fillRoundRect (250, 55, 300, 80);
  myGLCD.drawRoundRect (250, 55, 300, 80);
  myGLCD.print("OFF", 250, 60);
  myGLCD.fillRoundRect (250, 95, 300, 120);
  myGLCD.drawRoundRect (250, 95, 300, 120);
  myGLCD.print("OFF", 250, 100);
  myGLCD.fillRoundRect (250, 145, 300, 160);
  myGLCD.drawRoundRect (250, 145, 300, 160);
  myGLCD.print("OFF", 250, 140);
  myGLCD.fillRoundRect (190, 15, 240, 40);
  myGLCD.drawRoundRect (190, 15, 240, 40);
  myGLCD.print("OFF", 250, 180);
  myGLCD.fillRoundRect (190, 15, 240, 40);
  myGLCD.drawRoundRect (190, 15, 240, 40);
  myGLCD.print("OFF", 250, 220);
  }


void updateStr(int val)
{
  if (stCurrentLen<20)
  {
    stCurrent[stCurrentLen]=val;
    stCurrent[stCurrentLen+1]='\0';
    stCurrentLen++;
    myGLCD.setColor(0, 255, 0);
    myGLCD.print(stCurrent, LEFT, 224);
  }
  else
  {
    myGLCD.setColor(255, 0, 0);
    myGLCD.print("BUFFER FULL!", CENTER, 192);
    delay(500);
    myGLCD.print("            ", CENTER, 192);
    delay(500);
    myGLCD.print("BUFFER FULL!", CENTER, 192);
    delay(500);
    myGLCD.print("            ", CENTER, 192);
    myGLCD.setColor(0, 255, 0);
  }
}
// Draw a red frame while a button is touched
void waitForIt(int x1, int y1, int x2, int y2)
{
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
  while (myTouch.dataAvailable())
    myTouch.read();
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
}
void loop()
{
  while (true)
  {
    if (myTouch.dataAvailable())
    {
      myTouch.read();
      x=myTouch.getX();
      y=myTouch.getY();
      
      if ((y>=15) && (y<=200))  // Upper row
      {
        if ((x>=190) && (x<=240))  // Button: Bad ON
        digitalWrite(Relais1, LOW);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(190, 15, 240, 40);
                  }
        if ((x>=250) && (x<=300))  // Button: Bad OFF
        digitalWrite(Relais1, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(250, 15, 300, 40);
         }
            
        if ((x>=190) && (x<=240))  // Button: Kueche ON
        digitalWrite(Relais2, LOW);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(190, 55, 240, 80);
         
        }
        if ((x>=250) && (x<=300))  // Button: Kueche OFF
        digitalWrite(Relais2, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(250, 55, 300, 80);
        
        }
        if ((x>=190) && (x<=240))  // Button: Wohn ON
        digitalWrite(Relais3, LOW);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(190, 95, 240, 120);
       }
        if ((x>=250) && (x<=300))  // Button: Wohn OFF
        digitalWrite(Relais3, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(250, 95, 300, 120);

        }
        if ((x>=190) && (x<=240))  // Button: POOL ON
        digitalWrite(Relais4, LOW);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(190, 135, 240, 160);
        
        }
        if ((x>=250) && (x<=300))  // Button: POOL OFF
        digitalWrite(Relais4, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(250, 135, 300, 160);
        
        }
        if ((x>=190) && (x<=240))  // Button: Radio ON
        digitalWrite(Relais5, LOW);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(190, 175, 240, 200);
        
        }
        if ((x>=250) && (x<=300))  // Button: Radio OFF
        digitalWrite(Relais5, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(250, 175, 300, 200);
       }
        if ((x>=190) && (x<=240))  // Button: Radio ON
        digitalWrite(Relais6, LOW);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(190, 215, 240, 238);
        
        }
        if ((x>=250) && (x<=300))  // Button: Radio OFF
        digitalWrite(Relais6, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
          waitForIt(250, 215, 300, 238);
        }
      }
      //if ((y>=250) && (y<=300))  // Center row 
      //if ((x>=15) && (x<=40))  // Button: Bad OFF
       // digitalWrite(Relais1, HIGH);   // turn the LED on (HIGH is the voltage level)
        {
         // waitForIt(250, 15, 300, 40);
      
      

      //if ((y>=10) && (y<=180))  // Upper row
      {
       // if ((x>=10) && (x<=150))  // Button: Clear
        {
         // waitForIt(10, 130, 150, 180);
         // stCurrent[0]='\0';
         // stCurrentLen=0;
         // myGLCD.setColor(0, 0, 0);
          //myGLCD.fillRect(0, 224, 319, 239);
        }
       // if ((x>=160) && (x<=300))  // Button: Enter
        {
        //  waitForIt(160, 130, 300, 180);
        //  if (stCurrentLen>0)
          {
         //   for (x=0; x<stCurrentLen+1; x++)
            {
         //     stLast[x]=stCurrent[x];
            }
         //   stCurrent[0]='\0';
         //   stCurrentLen=0;
         //   myGLCD.setColor(0, 0, 0);
         //   myGLCD.fillRect(0, 208, 319, 239);
         //   myGLCD.setColor(0, 255, 0);
         //   myGLCD.print(stLast, LEFT, 208);
          }
//          else
          {
            //myGLCD.setColor(255, 0, 0);
            //myGLCD.print("BUFFER EMPTY", CENTER, 192);
            //delay(500);
            //myGLCD.print("            ", CENTER, 192);
            //delay(500);
            //myGLCD.print("BUFFER EMPTY", CENTER, 192);
            //delay(500);
            //myGLCD.print("            ", CENTER, 192);
            //myGLCD.setColor(0, 255, 0);
     
   }
   }
   }
   }
   }
   }
   }

Code bitte immer in Code-Tags setzen, das hat Uwe scheinbar in deinem Start-Poting gemacht.

Ansonsten fragst du immer nur die x-Position der Eingabe ab. Wenn alle Buttons in einer Spalte liegen, werden folglich auch alle Ausgänge geschaltet. Du brauchst also ebenso die y-Koordinate.
Der Code stammt aus irgendeinem Beispiel, das du nur nach bestem Wissen ergänzt hast, nicht wahr? :wink:

Ja kopiert und raus genommen nach meinen Bedürfnissen

ich hab schon so oft darüber geschaut nur find ich die y nicht

if ((y>=15) && (y<=200))  // Upper row

Damit wertest du ja den y-Bereich aus, der erfasst wird. Und hier steht "Upper row", also obere Reihe/Zeile. Diesen Bereich musst du für jede Zeile definieren, die Werte hast du dir ja auch schon beim Anlegen des Menüs überlegt.
Wozu man das Menü mit einer Schleife gleich sechsmal zeichnen muss verstehe ich auch nicht, genausowenig wie in der loop noch ein while (true) steht. :wink: