Show Posts
Pages: [1]
1  Using Arduino / Displays / 2.4 tft lcd touch shield pin mapping for Arduino Mega 2560 on: February 08, 2013, 05:16:35 pm
I have a iteadstudio 2.4 tft touch shield that currently works with my Arduino Uno R3 board.
I now want to get this shield working on the Arduino Mega 2560 R3 board.
first up this shield is a little old,
the manufactures does state that the board does work with the Arduino Mega
link http://imall.iteadstudio.com/development-platform/im120417012.html

this is the code from my sketch

#include <UTFT.h>
#include <UTouch.h>


// Uncomment the next two lines for the Arduino Mega

//This is my attemp in trying to initialize shield
UTFT        myGLCD(ITDB24E_8, A5,A4,A3,A2);   // Remember to change the model parameter to suit your display module!
UTouch      myTouch( A1, 10, A0, 8, 9); // original values 6,5,4,3,2);

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];

void setup(void)
{
  /* Start Ethernet sheild */
  Ethernet.begin( mac,ip,subnet,gateway );
  delay( 100 );
 
  /* Initalize LCD screen */ 
  myGLCD.InitLCD( 1 );

  /* Clear LCD Screen */
  myGLCD.clrScr();
 
  //myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor( VGA_AQUA );
  myGLCD.setFont( BigFont );
 
  myTouch.InitTouch( 1 );
  myTouch.setPrecision(PREC_HI);
  drawLCD();
}

void loop(void)
{
 
 if( myTouch.dataAvailable() )
 {
   myTouch.read();
   x = myTouch.getX();
   y = myTouch.getY();
 
 
   if( ( y >= 15 ) && ( y <= 122 ) )
     {
       if( (x >= 2 ) && ( x <= 148 ) )
       {
         //waitForItTemp0(5,5,309,230);
         //backButtonTemp0();
       }
     }
   
   
}
2  Using Arduino / Displays / Re: 2.4 tft lcd touch shield no response when touching screen on: February 05, 2013, 04:55:07 pm
Fixed it...  smiley-draw

this is what the issue is:
UTouch      myTouch(15,8,14,9,10); //original code
changed to
UTouch      myTouch(15,10,14,8,9); // now working

this is because the Utouch.cpp code calls the object with the following parameters
UTouch::UTouch(byte tclk,byte tcs, byte din, byte dout, byte irq)
{
T_CLK = tclk;
T_CS = tcs;
T_Din = din;
T_DOUT = dout;
T_IRQ = irq;
}
the Touch_CLK etc I got from the iteadstudio data sheet, so one can tell what pin numbers are used on the Arduino.
so the bottom line is the pin numbers need to pass in the correct order for the touch to work.
3  Using Arduino / Displays / 2.4 tft lcd touch shield no response when touching screen on: February 05, 2013, 08:35:25 am
Hi
I am trying to calibrate my 2.4" touch screen, using the in build UTouch_Calibration sketch provided
I am using an Arduino Uno R3
Touch screen is iteadstudio http://imall.iteadstudio.com/development-platform/im120417012.html

The program uploads and displays correctly but when trying to touch the screen to continue there is no response,
I am not sure if the initialization numbers are correct. smiley-eek

here is the code
#include <UTFT.h>
#include <UTouch.h>

// Define the orientation of the touch screen. Further
// information can be found in the instructions.
#define TOUCH_ORIENTATION  PORTRAIT

// Declare which fonts we will be using
extern uint8_t SmallFont[];

// Uncomment the next two lines for the Arduino 2009/UNO
UTFT        myGLCD(ITDB24E_8,19,18,17,16);   // Remember to change the model parameter to suit your display module!
UTouch      myTouch(15,8,14,9,10);

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

// ************************************
// DO NOT EDIT ANYTHING BELOW THIS LINE
// ************************************
uint32_t cx, cy;
uint32_t rx[10], ry[10];
uint32_t clx, crx, cty, cby;
float px, py;
int dispx, dispy, text_y_center;
uint32_t calx, caly, cals;
char buf[13];

void setup()
{
  myGLCD.InitLCD(); //do i need to place PORTRAIT in here?
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);

  myTouch.InitTouch(TOUCH_ORIENTATION);
  myTouch.setPrecision(PREC_LOW);
  dispx=myGLCD.getDisplayXSize();
  dispy=myGLCD.getDisplayYSize();
  text_y_center=(dispy/2)-6;
}
/////////////////////////
//REMOVED REST OF CODE FOR POST

Thanks
J
4  Using Arduino / Sensors / Re: Issue getting data into database from DS1820 temperture sensors on: January 28, 2013, 05:09:08 pm
Thanks you so much I just tried it out now and I can see the entries in my database tables .... it works!!!!! smiley
I9 really appreciate the help thanks
5  Using Arduino / Sensors / Issue getting data into database from DS1820 temperture sensors on: January 28, 2013, 04:19:19 am
Hi,
I am try to get my DS1820 temperature sensor addresses in to a mysql database.
I can get all the required field entries I require, temperature, but for the address I can only get the last 2 digits of the address into the database. smiley-sad

This is the function I have created. I am only using 2 temperature sensors.
addresses are  28DCBD4903000093 and  28B59A490300006F
I am wondering if this has to do with the webClient.print() and something else needs to be added like a char array??
the column in the database is set to Name: TempTag, Type: varchar(16), not null.
In the database column I get 93 or 6F
which is making me very confused...

/* Function */
void writeAddress( DeviceAddress deviceAddress )
{
  if( deviceAddress == insideThermometer )
  {
    Serial.println( "inside" );
    for( uint8_t i = 0; i < 8; i++ )
    {
      if( deviceAddress[ i ] < 16 )
      {
        Serial.println( "0" );
        webClient.print( "0" );
      }
      webClient.print( "&TempAddress0=" );
      webClient.print( deviceAddress[ i ], HEX );
    }
   
  }
  else if( deviceAddress == outsideThermometer )
  {
    Serial.println( "outside" );
    for(uint8_t j = 0; j < 8; j ++ )
    {
      if( deviceAddress[ j ] < 16 )
      {
        Serial.println( "0" );
        webClient.print( "0" );
      }
      webClient.print( "&TempAddress1=" );
      webClient.print( deviceAddress[ j ], HEX );
    }
   
  }
}
Pages: [1]