Touchscreen and TFT sharing UNO pins help needed


hello using tftlcd , touchscreen libraries make game. how ever need answer how setup pins reading , writing when using these libraries togehter.

since using 2.6" touc-lcd has sd memory card reader using (because there questions) have read may need carefull setup correct pins when using touchscreen. believe either sd card or lcd uses same pins touch panel need intialize pins when need them.

my code atm:

code: [select]
void loop(void){  
 initalizequestions(questioncount); //here subroutine picks random questions sdcard database public array
 for (int k=1, k == questioncount, k++) {
   clearscreen();
   writequestion(k); //this subroutine formats current question sdcard database public variables, question printed screen.
   
   // if you're sharing pins, you'll need fix directions of touchscreen pins!
   //pinmode(xp, output);
   pinmode(xm, output);
   pinmode(yp, output);
   //pinmode(ym, output);
       

   while(1) {
          if (touched(1)) break; //waits if area (1) touched give points , return 1 (true) , brake while loop , continue next question.
   }
   if (k == questioncount) {
    clearscreen();
    writeendscreen();
   
    // if you're sharing pins, you'll need fix directions of touchscreen pins!
    //pinmode(xp, output);
    pinmode(xm, output);
    pinmode(yp, output);
    //pinmode(ym, output);
   
    while(1) {
     if (touched(2)) brake; //waits if area (2) touched return 1 (true) , brake while loop , game starts beginning
    }
   }
 }  
}


at there have 2 times making touch screen intializations pins output waiting touch routine. need these 2 times or times when touch , when doing writing screen need setup pins again input?

if need switch them make subrutine handles touch screen intialisation when needed if can put these definitions setup routine these dont need float them in script.

can assistant me?

edited bit.


Arduino Forum > Using Arduino > Programming Questions > Touchscreen and TFT sharing UNO pins help needed


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support