Show Posts
Pages: 1 ... 39 40 [41] 42 43 ... 231
601  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 27, 2014, 02:44:07 am
Im updating the library right now so I'll put in comments.
I'll send you a link to the updated library, hopefully I'll get done with by tomorrow night, if not then the next day.

With the touch buttons and latch buttons, it takes two pairs of coordinates, the top left and bottom right. The circles are just one pair of XY coords and a radius. Also the XY coords you enter become the center of the circle.

The Latching buttons are the same except they need an identifying number on the end.
602  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 27, 2014, 02:20:31 am
I tried this on my screen and they appear on the top left corner of the screen. The green circle covers the small red circle, and he green circle does go off the screen a little bit, but I can still see it. Try moving them down the screen more.
603  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 27, 2014, 02:09:48 am
Post your full code if you can. If it is too long, you can make it an attachment under Additional Options, and I'll try it on my end.
604  Using Arduino / Programming Questions / Re: I think I'm storing too big of an array on: March 27, 2014, 02:06:14 am
What I think is happening is your are running out of memory, but only because you keep make new arrays each time you send out the IRsignal.

Put these at the top of your code globally and get rid of them where they are currently. You can just comment them out if you want.
Quote
//unsigned int Signal_Close[] = {1222,416,1248,416,416,1248,1248,416,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,884,780,104,1638,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,962,702,104,1638,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,416,1248,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW

unsigned int Signal_Open[] = {1144,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW

unsigned int Signal_Stop[] = {1196,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,16383}; //AnalysIR Batch Export - RAW

 
605  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 27, 2014, 12:31:22 am
Ok, the same coordinates you use to draw/fill in the button/circle are the same ones you use to touch the circle. This way it is just simple copy and paste. The tx and ty are the actual touch data from,
Quote
myTouch.read();
  int tx = myTouch.getX();
  int ty = myTouch.getY();
  int XC= tx > 320? 0 : tx;
  int YC= ty > 240? 0 : ty;
Except in this case, your passing the fixed touch data XC and YC into the getButton function. You can actually do without the part above, and just have like this, boolean button2 = myTFT.LatchButton(220,135,310,225,1); Notice no tx or ty, thats because I actually implemented it into the library itself.

The only real reason you would use the function with tx and ty, is if you want to use the raw touch data from myTouch.TP_X and myTouch.TP_Y. This is actually faster but it requires you to map the screen and use the map function. Like this,
Quote
myTouch.read();
  tx = myTouch.TP_X;
  ty = myTouch.TP_Y;
  XC = constrain(map(tx, 205, 3900,0,239),0,239); // raw touch data converted to pixel data
  YC = constrain(map(ty, 300, 3850,0,319),0,319);//------------------------------------------

Oh and btw, the 1 in "LatchButton(220,135,310,225,1)" is a identification number, which as of right now, you can have 10 in total. You can have as many as you need, but you will need to change the value of this line in the .h file #define Num_Of_Buttons 10

My library doesn't draw or fill in the button when you add in the button functions, so you need to make those seperate, which is also why the sketch has a makeButton function.
Quote
void makeButton()
{
  myGLCD.setColor(255,255,255);
  myGLCD.drawCircle(55,180,50);// circle button 1

  myGLCD.setColor(255,0,0);
  myGLCD.fillCircle(265,55,50);// circle button 2

  myGLCD.setColor(0,255,0);
  myGLCD.drawRect(10,10,100,100);// rect button 1

  myGLCD.setColor(0,0,255);
  myGLCD.fillRect(220,135,310,225);// rect button 2
}

It is called in the setup function so it only runs once, but you can lock and unlock it if you ever need to remake the buttons.
606  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 11:38:34 pm
Your welcome, I'm happy to hear my library was able to help you.

607  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 11:23:22 pm
So instead of a latching button, change it to touch button, myTFT.TouchButton(220,135,310,225);
608  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 11:14:24 pm
You need to add those at the top, they are boolean, here:

boolean last = LOW, latch = false;
609  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 11:09:57 pm
You would do it like so, put this after this line boolean button2 = myTFT.LatchButton(220,135,310,225,1);
Code:
  if (button2 != last)
  {
    latch = !latch;
    if(latch)
    {
      myGLCD.setColor(255,0,0);
      myGLCD.fillRect(220,135,310,225);// rect button 1
    }
    else
    {
      myGLCD.setColor(0,255,0);
      myGLCD.fillRect(220,135,310,225);// rect button 1
    }
  }
  last = button2;

The number in the center will still show as blue but you can disable the text by commenting it out.
I am still adding things to this library, so I will add this in it. You can follow the progress with this link.
New TFT_Extension
610  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 10:56:18 pm
? there boolean so it should be 0 and 1.

Being that my LCD and sketch uses the older library, there might be things that you need to set like text transparency.

Compare the sketch that came with the UTFT library to what I have, in my sketch. You should see text.
611  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 10:39:01 pm
This is incorrect,
Quote
UTFT myGLCD(38,39,40,41,ITDB32S);
It should be UTFT myGLCD(ITDB32S,38,39,40,41);

UTFT::UTFT(byte model, int RS, int WR,int CS, int RST, int SER)
612  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 10:28:58 pm
Nothing at all? Not even these?
Quote
myGLCD.setColor(255, 0, 0);//red box fill
  myGLCD.fillRect(0, 0, 319, 13);//text box
613  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 10:03:54 pm
Yea, try it. Look at one of the example sketches to see how to set it up.
614  Using Arduino / Programming Questions / Re: Using TFT button for dual purposes on: March 26, 2014, 08:25:51 pm
Yea, of course, but you will need a latch.

Read the coords, if the button is pressed, and not held, change the button color and state.

Here is an example you can use, but instead of an actual button, you can use the touch screen coords.
Code:
byte LEDpin = 13; //on-board LED
byte ButtonPin = 2; //digital pin 2

boolean button,last = LOW;
boolean latch = false;

void setup() {
  pinMode(LEDpin, OUTPUT);
  pinMode(ButtonPin, INPUT);
}

void loop()
{
  button = digitalRead(ButtonPin);
  if (button == HIGH && button != last)
  {
    latch = !latch;
    latch ? digitalWrite(LEDpin, HIGH): digitalWrite(LEDpin, LOW);
  }
  last = button;
}

Or if you want, you can download my TFT library, where I have already done just that.
TFT_Extension.zip

You may need to change the libraries in my example sketches. I have the old ITDB02 libraries, but my TFT library should work with the ones you have. If not, then let me know and I'll tell you what to fix to get it to work.
615  Using Arduino / Project Guidance / Re: Wristwatch with four buttons and Nokia 5110 on: March 26, 2014, 05:56:39 pm
@raschemmel

Those might be a little too big to fit into a watch, he might want these instead.
Mini tactile buttons.
Pages: 1 ... 39 40 [41] 42 43 ... 231