0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« on: August 15, 2012, 11:08:14 am » |
hi there im having problems uploading ITDB02_Touch calibiration to my mega2560 with my 3.2 wc utft i haveinstalled libraries ITDB02_Touch ITDB02_graph ITDB02_graph16 utft code error; no matching funtion for call to 'ITDB)"_Touch::ITDB02_touch(int, int, int, int)' code im using // ITDB02_Touch_Calibration (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // // This program can be used to calibrate the touchscreen // of the ITDB02 modules. // This program requires the ITDB02_Graph library (8bit mode) // or ITDB02_Graph16 (16bit mode). // // It is assumed that the ITDB02 module is connected to a // ITDB02 Shield, a ITDB02 Mega Shield or that you know how // to change the pin numbers in the setup. // // Instructions will be given on the display. //
// Remember to change the next line if you are using as 16bit module! #include <ITDB02_Graph.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t SmallFont[];
// Uncomment the next two lines for the ITDB02 Shield //ITDB02 myGLCD(19,18,17,16); //ITDB02_Touch myTouch(15,10,14,9,8);
// Uncomment the next two lines for the ITDB02 Mega Shield ITDB02 myGLCD(38,39,40,41); // Remember to add ASPECT_16x9 if you are using an ITDB02-3.2WC! ITDB02_Touch myTouch(6,5,4,3,2);
int cx, cy; int rx[10], ry[10]; float px, py; int ox, oy;
void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(SmallFont);
myTouch.InitTouch(); myTouch.setPrecision(PREC_LOW); }
void drawCrossHair(int x, int y) { myGLCD.drawRect(x-10, y-10, x+10, y+10); myGLCD.drawLine(x-5, y, x+5, y); myGLCD.drawLine(x, y-5, x, y+5); }
void readCoordinates() { int iter = 2000; int cnt = 0; unsigned long tx=0; unsigned long ty=0; boolean OK = false; while (OK == false) { while (myTouch.dataAvailable() == false) {} while ((myTouch.dataAvailable() == true) && (cnt<iter)) { myTouch.read(); tx += myTouch.TP_X; ty += myTouch.TP_Y; cnt++; } if (cnt>=iter) { OK = true; } else { tx = 0; ty = 0; cnt = 0; } }
cx = tx / iter; cy = ty / iter;
}
void calibrate(int x, int y, int i) { myGLCD.setColor(255, 255, 255); drawCrossHair(x,y); readCoordinates(); myGLCD.setColor(80, 80, 80); drawCrossHair(x,y); rx[i]=cx; ry[i]=cy; while (myTouch.dataAvailable() == true) { myTouch.read(); } }
void waitForTouch() { while (myTouch.dataAvailable() == true) { myTouch.read(); } while (myTouch.dataAvailable() == false) {} while (myTouch.dataAvailable() == true) { myTouch.read(); } }
void startup() { myGLCD.setColor(255, 0, 0); myGLCD.fillRect(0, 0, 239, 13); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(255, 0, 0); myGLCD.drawLine(0, 14, 239, 14); myGLCD.print("ITDB02 TOUCH CALIBRATION", CENTER, 1); myGLCD.setBackColor(0, 0, 0); myGLCD.print("INSTRUCTIONS", CENTER, 30); myGLCD.print("Use a stylus or something", LEFT, 50); myGLCD.print("similar to touch as close to", LEFT, 62); myGLCD.print("the center of the highlighted", LEFT, 74); myGLCD.print("crosshair as possible. Keep as", LEFT, 86); myGLCD.print("still as possible and keep", LEFT, 98); myGLCD.print("holding until the highlight is", LEFT, 110); myGLCD.print("removed. Repeat for all", LEFT, 122); myGLCD.print("crosshairs in sequence.", LEFT, 134); myGLCD.print("Further instructions will be", LEFT, 158); myGLCD.print("displayed when the calibration", LEFT, 170); myGLCD.print("is complete.", LEFT, 182); myGLCD.print("Do NOT use your finger as a", LEFT, 206); myGLCD.print("calibration stylus or the", LEFT, 218); myGLCD.print("result WILL BE very imprecise.", LEFT, 230); myGLCD.print("Touch screen to continue", CENTER, 305);
waitForTouch(); myGLCD.clrScr(); }
void done() { myGLCD.clrScr(); myGLCD.setColor(255, 0, 0); myGLCD.fillRect(0, 0, 239, 13); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(255, 0, 0); myGLCD.drawLine(0, 14, 239, 14); myGLCD.print("ITDB02 TOUCH CALIBRATION", CENTER, 1); myGLCD.setBackColor(0, 0, 0); myGLCD.print("CALIBRATION COMPLETE", CENTER, 30); myGLCD.print("To use the new calibration", LEFT, 50); myGLCD.print("settings you must edit the", LEFT, 62); myGLCD.setColor(160, 160, 255); myGLCD.print("ITDB02_Touch.cpp", LEFT, 74); myGLCD.setColor(255, 255, 255); myGLCD.print("file and", 136, 74); myGLCD.print("change the following values.", LEFT, 86); myGLCD.print("The values are located right", LEFT, 98); myGLCD.print("below the opening comment in", LEFT, 110); myGLCD.print("the file.", LEFT, 122); myGLCD.print("PixSizeX", LEFT, 158); myGLCD.print("PixOffsX", LEFT, 170); myGLCD.print("PixSizeY", LEFT, 182); myGLCD.print("PixOffsY", LEFT, 194); myGLCD.print("Connected module:", LEFT, 250); myGLCD.drawLine(0, 155, 239, 155); myGLCD.drawLine(0, 209, 239, 209);
myGLCD.printNumF(px, 2, 100, 158); myGLCD.printNumI(ox, 100, 170); myGLCD.printNumF(py, 2, 100, 182); myGLCD.printNumI(oy, 100, 194); if (px>=0) myGLCD.print("2.4\"", 144, 250); else { if (py>=0) { myGLCD.print("3.2\"", 144, 250); myGLCD.print("Negative numbers for PixSizeX", LEFT, 270); myGLCD.print("is expected :)", LEFT, 282); } else { myGLCD.print("3.2\" Wide", 144, 250); myGLCD.print("Negative numbers for PixSizeX", LEFT, 270); myGLCD.print("and PixSizeY are expected :)", LEFT, 282); } } }
void loop() { startup(); myGLCD.setColor(80, 80, 80); drawCrossHair(10,10); drawCrossHair(10,160); drawCrossHair(10,309); drawCrossHair(120,10); drawCrossHair(120,160); drawCrossHair(120,309); drawCrossHair(229,10); drawCrossHair(229,160); drawCrossHair(229,309); calibrate(10, 10, 0); calibrate(10, 160, 1); calibrate(10, 309, 2); calibrate(120, 10, 3); calibrate(120, 160, 4); calibrate(120, 309, 5); calibrate(229, 10, 6); calibrate(229, 160, 7); calibrate(229, 309, 8); px = ((float(rx[0]+rx[1]+rx[2])/3)-(float(rx[6]+rx[7]+rx[8])/3))/220; if (px>=0) ox = (((rx[6]+rx[7]+rx[8])/3))-(px*10); else ox = (((rx[0]+rx[1]+rx[2])/3))+(px*10);
py = ((float(ry[0]+ry[3]+ry[6])/3)-(float(ry[2]+ry[5]+ry[8])/3))/300; if (py>=0) oy = (((ry[2]+ry[5]+ry[8])/3))-(py*10); else oy = (((ry[0]+ry[3]+ry[6])/3))+(py*10);
done(); while(true) {} }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #1 on: August 15, 2012, 12:57:51 pm » |
#include <ITDB02_Graph.h> is not needed for Mega unless your using 8bit mode. change it to #include <UTFT.h> also change ITDB02 myGLCD(38,39,40,41); for UTFT myGLCD(ITDB32S,38,39,40,41); I've compiled it on IDE_0018 with Nega1280 and it works fine nearly forgot put this in setup, it sets orientation myGLCD.InitLCD(PORTRAIT); myTouch.InitTouch(PORTRAIT); Shaun
|
|
|
|
« Last Edit: August 15, 2012, 01:10:27 pm by P18F4550 »
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« Reply #2 on: August 15, 2012, 03:13:29 pm » |
now brings up Error compilling what have i dun now lol sorry if im being a bit dumb new to this // ITDB02_Touch_Calibration (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // // This program can be used to calibrate the touchscreen // of the ITDB02 modules. // This program requires the ITDB02_Graph library (8bit mode) // or ITDB02_Graph16 (16bit mode). // // It is assumed that the ITDB02 module is connected to a // ITDB02 Shield, a ITDB02 Mega Shield or that you know how // to change the pin numbers in the setup. // // Instructions will be given on the display. //
// Remember to change the next line if you are using as 16bit module! #include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t SmallFont[];
// Uncomment the next two lines for the ITDB02 Shield //ITDB02 myGLCD(19,18,17,16); //ITDB02_Touch myTouch(15,10,14,9,8);
// Uncomment the next two lines for the ITDB02 Mega Shield UTFT myGLCD(ITDB32S,38,39,40,41); ITDB02_Touch myTouch(6,5,4,3,2);
int cx, cy; int rx[10], ry[10]; float px, py; int ox, oy;
void setup() { myGLCD.InitLCD(PORTRAIT); myTouch.InitTouch(PORTRAIT);
myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(SmallFont);
myTouch.InitTouch(); myTouch.setPrecision(PREC_LOW); }
void drawCrossHair(int x, int y) { myGLCD.drawRect(x-10, y-10, x+10, y+10); myGLCD.drawLine(x-5, y, x+5, y); myGLCD.drawLine(x, y-5, x, y+5); }
void readCoordinates() { int iter = 2000; int cnt = 0; unsigned long tx=0; unsigned long ty=0; boolean OK = false; while (OK == false) { while (myTouch.dataAvailable() == false) {} while ((myTouch.dataAvailable() == true) && (cnt<iter)) { myTouch.read(); tx += myTouch.TP_X; ty += myTouch.TP_Y; cnt++; } if (cnt>=iter) { OK = true; } else { tx = 0; ty = 0; cnt = 0; } }
cx = tx / iter; cy = ty / iter;
}
void calibrate(int x, int y, int i) { myGLCD.setColor(255, 255, 255); drawCrossHair(x,y); readCoordinates(); myGLCD.setColor(80, 80, 80); drawCrossHair(x,y); rx[i]=cx; ry[i]=cy; while (myTouch.dataAvailable() == true) { myTouch.read(); } }
void waitForTouch() { while (myTouch.dataAvailable() == true) { myTouch.read(); } while (myTouch.dataAvailable() == false) {} while (myTouch.dataAvailable() == true) { myTouch.read(); } }
void startup() { myGLCD.setColor(255, 0, 0); myGLCD.fillRect(0, 0, 239, 13); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(255, 0, 0); myGLCD.drawLine(0, 14, 239, 14); myGLCD.print("ITDB02 TOUCH CALIBRATION", CENTER, 1); myGLCD.setBackColor(0, 0, 0); myGLCD.print("INSTRUCTIONS", CENTER, 30); myGLCD.print("Use a stylus or something", LEFT, 50); myGLCD.print("similar to touch as close to", LEFT, 62); myGLCD.print("the center of the highlighted", LEFT, 74); myGLCD.print("crosshair as possible. Keep as", LEFT, 86); myGLCD.print("still as possible and keep", LEFT, 98); myGLCD.print("holding until the highlight is", LEFT, 110); myGLCD.print("removed. Repeat for all", LEFT, 122); myGLCD.print("crosshairs in sequence.", LEFT, 134); myGLCD.print("Further instructions will be", LEFT, 158); myGLCD.print("displayed when the calibration", LEFT, 170); myGLCD.print("is complete.", LEFT, 182); myGLCD.print("Do NOT use your finger as a", LEFT, 206); myGLCD.print("calibration stylus or the", LEFT, 218); myGLCD.print("result WILL BE very imprecise.", LEFT, 230); myGLCD.print("Touch screen to continue", CENTER, 305);
waitForTouch(); myGLCD.clrScr(); }
void done() { myGLCD.clrScr(); myGLCD.setColor(255, 0, 0); myGLCD.fillRect(0, 0, 239, 13); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(255, 0, 0); myGLCD.drawLine(0, 14, 239, 14); myGLCD.print("ITDB02 TOUCH CALIBRATION", CENTER, 1); myGLCD.setBackColor(0, 0, 0); myGLCD.print("CALIBRATION COMPLETE", CENTER, 30); myGLCD.print("To use the new calibration", LEFT, 50); myGLCD.print("settings you must edit the", LEFT, 62); myGLCD.setColor(160, 160, 255); myGLCD.print("ITDB02_Touch.cpp", LEFT, 74); myGLCD.setColor(255, 255, 255); myGLCD.print("file and", 136, 74); myGLCD.print("change the following values.", LEFT, 86); myGLCD.print("The values are located right", LEFT, 98); myGLCD.print("below the opening comment in", LEFT, 110); myGLCD.print("the file.", LEFT, 122); myGLCD.print("PixSizeX", LEFT, 158); myGLCD.print("PixOffsX", LEFT, 170); myGLCD.print("PixSizeY", LEFT, 182); myGLCD.print("PixOffsY", LEFT, 194); myGLCD.print("Connected module:", LEFT, 250); myGLCD.drawLine(0, 155, 239, 155); myGLCD.drawLine(0, 209, 239, 209);
myGLCD.printNumF(px, 2, 100, 158); myGLCD.printNumI(ox, 100, 170); myGLCD.printNumF(py, 2, 100, 182); myGLCD.printNumI(oy, 100, 194); if (px>=0) myGLCD.print("2.4\"", 144, 250); else { if (py>=0) { myGLCD.print("3.2\"", 144, 250); myGLCD.print("Negative numbers for PixSizeX", LEFT, 270); myGLCD.print("is expected :)", LEFT, 282); } else { myGLCD.print("3.2\" Wide", 144, 250); myGLCD.print("Negative numbers for PixSizeX", LEFT, 270); myGLCD.print("and PixSizeY are expected :)", LEFT, 282); } } }
void loop() { startup(); myGLCD.setColor(80, 80, 80); drawCrossHair(10,10); drawCrossHair(10,160); drawCrossHair(10,309); drawCrossHair(120,10); drawCrossHair(120,160); drawCrossHair(120,309); drawCrossHair(229,10); drawCrossHair(229,160); drawCrossHair(229,309); calibrate(10, 10, 0); calibrate(10, 160, 1); calibrate(10, 309, 2); calibrate(120, 10, 3); calibrate(120, 160, 4); calibrate(120, 309, 5); calibrate(229, 10, 6); calibrate(229, 160, 7); calibrate(229, 309, 8); px = ((float(rx[0]+rx[1]+rx[2])/3)-(float(rx[6]+rx[7]+rx[8])/3))/220; if (px>=0) ox = (((rx[6]+rx[7]+rx[8])/3))-(px*10); else ox = (((rx[0]+rx[1]+rx[2])/3))+(px*10);
py = ((float(ry[0]+ry[3]+ry[6])/3)-(float(ry[2]+ry[5]+ry[8])/3))/300; if (py>=0) oy = (((ry[2]+ry[5]+ry[8])/3))-(py*10); else oy = (((ry[0]+ry[3]+ry[6])/3))+(py*10);
done(); while(true) {} }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #3 on: August 15, 2012, 04:24:17 pm » |
Well that's strange, with IDE_1.0.1 i get In file included from ITDB02_Touch_Calibration.cpp:18: /home/shaun/arduino-1.0.1/libraries/ITDB02_Touch/ITDB02_Touch.h:44:22: error: WProgram.h: No such file or directory but with IDE_0018 i dont get the error what error are you getting? have you tried the UTFT font example? what version of Arduino IDE are you using?
|
|
|
|
« Last Edit: August 15, 2012, 04:50:19 pm by P18F4550 »
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #4 on: August 15, 2012, 04:59:13 pm » |
ok the answer to the error is In ITDB02_Touch.h change #include "WProgram.h" to #include "Arduino.h" do the same in ITDB02_Touch.cpp now no error, the calibration program works // ITDB02_Touch_Calibration (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // // This program can be used to calibrate the touchscreen // of the ITDB02 modules. // This program requires the ITDB02_Graph library (8bit mode) // or ITDB02_Graph16 (16bit mode). // // It is assumed that the ITDB02 module is connected to a // ITDB02 Shield, a ITDB02 Mega Shield or that you know how // to change the pin numbers in the setup. // // Instructions will be given on the display. //
// Remember to change the next line if you are using as 16bit module! #include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t SmallFont[];
// Uncomment the next two lines for the ITDB02 Mega Shield UTFT myGLCD(ITDB32S,38,39,40,41); // Remember to add ASPECT_16x9 if you are using an ITDB02-3.2WC! ITDB02_Touch myTouch(6,5,4,3,2);
int cx, cy; int rx[10], ry[10]; float px, py; int ox, oy;
void setup() { myGLCD.InitLCD(PORTRAIT); myGLCD.clrScr(); myGLCD.setFont(SmallFont);
myTouch.InitTouch(PORTRAIT); myTouch.setPrecision(PREC_LOW); }
void drawCrossHair(int x, int y) { myGLCD.drawRect(x-10, y-10, x+10, y+10); myGLCD.drawLine(x-5, y, x+5, y); myGLCD.drawLine(x, y-5, x, y+5); }
void readCoordinates() { int iter = 2000; int cnt = 0; unsigned long tx=0; unsigned long ty=0; boolean OK = false; while (OK == false) { while (myTouch.dataAvailable() == false) {} while ((myTouch.dataAvailable() == true) && (cnt<iter)) { myTouch.read(); tx += myTouch.TP_X; ty += myTouch.TP_Y; cnt++; } if (cnt>=iter) { OK = true; } else { tx = 0; ty = 0; cnt = 0; } }
cx = tx / iter; cy = ty / iter;
}
void calibrate(int x, int y, int i) { myGLCD.setColor(255, 255, 255); drawCrossHair(x,y); readCoordinates(); myGLCD.setColor(80, 80, 80); drawCrossHair(x,y); rx[i]=cx; ry[i]=cy; while (myTouch.dataAvailable() == true) { myTouch.read(); } }
void waitForTouch() { while (myTouch.dataAvailable() == true) { myTouch.read(); } while (myTouch.dataAvailable() == false) {} while (myTouch.dataAvailable() == true) { myTouch.read(); } }
void startup() { myGLCD.setColor(255, 0, 0); myGLCD.fillRect(0, 0, 239, 13); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(255, 0, 0); myGLCD.drawLine(0, 14, 239, 14); myGLCD.print("ITDB02 TOUCH CALIBRATION", CENTER, 1); myGLCD.setBackColor(0, 0, 0); myGLCD.print("INSTRUCTIONS", CENTER, 30); myGLCD.print("Use a stylus or something", LEFT, 50); myGLCD.print("similar to touch as close to", LEFT, 62); myGLCD.print("the center of the highlighted", LEFT, 74); myGLCD.print("crosshair as possible. Keep as", LEFT, 86); myGLCD.print("still as possible and keep", LEFT, 98); myGLCD.print("holding until the highlight is", LEFT, 110); myGLCD.print("removed. Repeat for all", LEFT, 122); myGLCD.print("crosshairs in sequence.", LEFT, 134); myGLCD.print("Further instructions will be", LEFT, 158); myGLCD.print("displayed when the calibration", LEFT, 170); myGLCD.print("is complete.", LEFT, 182); myGLCD.print("Do NOT use your finger as a", LEFT, 206); myGLCD.print("calibration stylus or the", LEFT, 218); myGLCD.print("result WILL BE very imprecise.", LEFT, 230); myGLCD.print("Touch screen to continue", CENTER, 305);
waitForTouch(); myGLCD.clrScr(); }
void done() { myGLCD.clrScr(); myGLCD.setColor(255, 0, 0); myGLCD.fillRect(0, 0, 239, 13); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(255, 0, 0); myGLCD.drawLine(0, 14, 239, 14); myGLCD.print("ITDB02 TOUCH CALIBRATION", CENTER, 1); myGLCD.setBackColor(0, 0, 0); myGLCD.print("CALIBRATION COMPLETE", CENTER, 30); myGLCD.print("To use the new calibration", LEFT, 50); myGLCD.print("settings you must edit the", LEFT, 62); myGLCD.setColor(160, 160, 255); myGLCD.print("ITDB02_Touch.cpp", LEFT, 74); myGLCD.setColor(255, 255, 255); myGLCD.print("file and", 136, 74); myGLCD.print("change the following values.", LEFT, 86); myGLCD.print("The values are located right", LEFT, 98); myGLCD.print("below the opening comment in", LEFT, 110); myGLCD.print("the file.", LEFT, 122); myGLCD.print("PixSizeX", LEFT, 158); myGLCD.print("PixOffsX", LEFT, 170); myGLCD.print("PixSizeY", LEFT, 182); myGLCD.print("PixOffsY", LEFT, 194); myGLCD.print("Connected module:", LEFT, 250); myGLCD.drawLine(0, 155, 239, 155); myGLCD.drawLine(0, 209, 239, 209);
myGLCD.printNumF(px, 2, 100, 158); myGLCD.printNumI(ox, 100, 170); myGLCD.printNumF(py, 2, 100, 182); myGLCD.printNumI(oy, 100, 194); if (px>=0) myGLCD.print("2.4\"", 144, 250); else { if (py>=0) { myGLCD.print("3.2\"", 144, 250); myGLCD.print("Negative numbers for PixSizeX", LEFT, 270); myGLCD.print("is expected :)", LEFT, 282); } else { myGLCD.print("3.2\" Wide", 144, 250); myGLCD.print("Negative numbers for PixSizeX", LEFT, 270); myGLCD.print("and PixSizeY are expected :)", LEFT, 282); } } }
void loop() { startup(); myGLCD.setColor(80, 80, 80); drawCrossHair(10,10); drawCrossHair(10,160); drawCrossHair(10,309); drawCrossHair(120,10); drawCrossHair(120,160); drawCrossHair(120,309); drawCrossHair(229,10); drawCrossHair(229,160); drawCrossHair(229,309); calibrate(10, 10, 0); calibrate(10, 160, 1); calibrate(10, 309, 2); calibrate(120, 10, 3); calibrate(120, 160, 4); calibrate(120, 309, 5); calibrate(229, 10, 6); calibrate(229, 160, 7); calibrate(229, 309, 8); px = ((float(rx[0]+rx[1]+rx[2])/3)-(float(rx[6]+rx[7]+rx[8])/3))/220; if (px>=0) ox = (((rx[6]+rx[7]+rx[8])/3))-(px*10); else ox = (((rx[0]+rx[1]+rx[2])/3))+(px*10);
py = ((float(ry[0]+ry[3]+ry[6])/3)-(float(ry[2]+ry[5]+ry[8])/3))/300; if (py>=0) oy = (((ry[2]+ry[5]+ry[8])/3))-(py*10); else oy = (((ry[0]+ry[3]+ry[6])/3))+(py*10);
done(); while(true) {} }
|
|
|
|
« Last Edit: August 15, 2012, 05:00:55 pm by P18F4550 »
|
Logged
|
|
|
|
|
Chile
Offline
Edison Member
Karma: 29
Posts: 1148
Arduino rocks
|
 |
« Reply #5 on: August 15, 2012, 06:00:26 pm » |
There is a new version of this library for Arduino 1.0
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« Reply #6 on: August 16, 2012, 02:26:55 pm » |
but with IDE_0018 i dont get the error
what error are you getting?
have you tried the UTFT font example?
what version of Arduino IDE are you using?
just says error compiling then inside the box in file included from touch_calibration.cpp:18:c:\Users\Joe\Documents\arduino-1.0\libraries\ITDB02_touch/ITDB02_Touch.h:44:22:error: WProgram.h: no such file or directory yes i can get a pic up on it arduino 1.0 In my ITDB02_Touch folder the one In ITDB02_Touch Type is Arduino.h and the other one ITDB02 Touch WProgram.h is this ok?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #7 on: August 17, 2012, 03:43:01 am » |
please see post NO.4 ok the answer to the error is
In ITDB02_Touch.h change #include "WProgram.h" to #include "Arduino.h"
do the same in
ITDB02_Touch.cpp I don't use Arduino 1.0 very often because all my code was written in IDE_0018. but i used it for this error and the calibration code is working for me, hope it works for you
|
|
|
|
« Last Edit: August 17, 2012, 03:48:33 am by P18F4550 »
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« Reply #8 on: August 19, 2012, 10:52:11 am » |
HI there just to let you no i did it on arduino 0022 and it now work's fine
has anybody got some good recommendations to have a look at some simple examples to get the nack of how to use this libraby?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #9 on: August 19, 2012, 12:08:29 pm » |
has anybody got some good recommendations to have a look at some simple examples to get the nack of how to use this libraby? Basically just play with it, that's how i leaned, sometimes it's hard to understand another persons code unless you do it yourself. Have a look at the button example that comes with the library, it's a good place to start, maybe just start with one button first, and when you get the hang of detecting touch and getting co-ordinates then try 2 buttons or more. The code is quite daunting to look at to start with but you'll soon get the hang of it
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« Reply #10 on: August 19, 2012, 01:20:01 pm » |
ok cool just upload that up on my arduino compiled fine and upload fine brings up the display fine but the touch does not work dont no if i have missed something out want to get it right before i start looking at it // ITDB02_Touch_ButtonTest (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // // This program is a quick demo of how create and use buttons. // // This program requires the ITDB02_Graph library (8bit mode) // or ITDB02_Graph16 (16bit mode). // // It is assumed that the ITDB02 module is connected to a // ITDB02 Shield, a ITDB02 Mega Shield or that you know how // to change the pin numbers in the setup. //
// Remember to change the next line if you are using as 16bit module! #include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t BigFont[];
// Uncomment the next two lines for the ITDB02 Shield UTFT myGLCD(ITDB32S,38,39,40,41); ITDB02_Touch myTouch(15,10,14,9,8);
// Uncomment the next two lines for the ITDB02 Mega Shield //ITDB02 myGLCD(38,39,40,41); // Remember to add ASPECT_16x9 if you are using an ITDB02-3.2WC! //ITDB02_Touch myTouch(6,5,4,3,2);
int x, y; char stCurrent[20]=""; int stCurrentLen=0; char stLast[20]="";
void setup() { myGLCD.InitLCD(PORTRAIT); myTouch.InitTouch(PORTRAIT); // Initial setup myGLCD.InitLCD(LANDSCAPE); myGLCD.clrScr();
myTouch.InitTouch(LANDSCAPE); myTouch.setPrecision(PREC_MEDIUM);
myGLCD.setFont(BigFont); myGLCD.setBackColor(0, 0, 255); // Draw the upper row of buttons for (x=0; x<5; x++) { myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (10+(x*60), 10, 60+(x*60), 60); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (10+(x*60), 10, 60+(x*60), 60); myGLCD.printNumI(x+1, 27+(x*60), 27); } // Draw the center row of buttons for (x=0; x<5; x++) { myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (10+(x*60), 70, 60+(x*60), 120); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (10+(x*60), 70, 60+(x*60), 120); if (x<4) myGLCD.printNumI(x+6, 27+(x*60), 87); } myGLCD.print("0", 267, 87); // Draw the lower row of buttons myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (10, 130, 150, 180); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (10, 130, 150, 180); myGLCD.print("Clear", 40, 147); myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (160, 130, 300, 180); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (160, 130, 300, 180); myGLCD.print("Enter", 190, 147); myGLCD.setBackColor (0, 0, 0); }
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>=10) && (y<=60)) // Upper row { if ((x>=10) && (x<=60)) // Button: 1 { waitForIt(10, 10, 60, 60); updateStr('1'); } if ((x>=70) && (x<=120)) // Button: 2 { waitForIt(70, 10, 120, 60); updateStr('2'); } if ((x>=130) && (x<=180)) // Button: 3 { waitForIt(130, 10, 180, 60); updateStr('3'); } if ((x>=190) && (x<=240)) // Button: 4 { waitForIt(190, 10, 240, 60); updateStr('4'); } if ((x>=250) && (x<=300)) // Button: 5 { waitForIt(250, 10, 300, 60); updateStr('5'); } }
if ((y>=70) && (y<=120)) // Center row { if ((x>=10) && (x<=60)) // Button: 6 { waitForIt(10, 70, 60, 120); updateStr('6'); } if ((x>=70) && (x<=120)) // Button: 7 { waitForIt(70, 70, 120, 120); updateStr('7'); } if ((x>=130) && (x<=180)) // Button: 8 { waitForIt(130, 70, 180, 120); updateStr('8'); } if ((x>=190) && (x<=240)) // Button: 9 { waitForIt(190, 70, 240, 120); updateStr('9'); } if ((x>=250) && (x<=300)) // Button: 0 { waitForIt(250, 70, 300, 120); updateStr('0'); } }
if ((y>=130) && (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); } } } } } }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #11 on: August 19, 2012, 02:34:11 pm » |
// Uncomment the next two lines for the ITDB02 Shield //UTFT myGLCD(ITDB32S,38,39,40,41); //ITDB02_Touch myTouch(15,10,14,9,8);
// [color=red]Uncomment the next two lines for the ITDB02 Mega Shield[/color] ITDB02 myGLCD(38,39,40,41); // Remember to add ASPECT_16x9 if you are using an ITDB02-3.2WC! ITDB02_Touch myTouch(6,5,4,3,2); The clue is here, your using Mega2560, so // top 2 lines and uncomment the 2 for Mega
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« Reply #12 on: August 20, 2012, 12:58:41 pm » |
lol that was a bit obvious and embarrasing sorry well i uploaded it to my arduino, the touch worked but all in the wrong places so i presumed i did the caliberation correctly so i preformed that again and now it seems i have nothing touch wise working does this all look reasonably correct? #define PixSizeX 0.08 #define PixOffsX 1329 #define PixSizeY 0.01 #define PixOffsY 1641 // ITDB02_Touch_ButtonTest (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // // This program is a quick demo of how create and use buttons. // // This program requires the ITDB02_Graph library (8bit mode) // or ITDB02_Graph16 (16bit mode). // // It is assumed that the ITDB02 module is connected to a // ITDB02 Shield, a ITDB02 Mega Shield or that you know how // to change the pin numbers in the setup. //
// Remember to change the next line if you are using as 16bit module! #include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t BigFont[];
// Uncomment the next two lines for the ITDB02 Shield //UTFT myGLCD(ITDB32S,38,39,40,41); //ITDB02_Touch myTouch(15,10,14,9,8);
// Uncomment the next two lines for the ITDB02 Mega Shield UTFT myGLCD(ITDB32S,38,39,40,41); // Remember to add ASPECT_16x9 if you are using an ITDB02-3.2WC! ITDB02_Touch myTouch(6,5,4,3,2);
int x, y; char stCurrent[20]=""; int stCurrentLen=0; char stLast[20]="";
void setup() { myGLCD.InitLCD(PORTRAIT); myTouch.InitTouch(PORTRAIT); // Initial setup myGLCD.InitLCD(LANDSCAPE); myGLCD.clrScr();
myTouch.InitTouch(LANDSCAPE); myTouch.setPrecision(PREC_MEDIUM);
myGLCD.setFont(BigFont); myGLCD.setBackColor(0, 0, 255); // Draw the upper row of buttons for (x=0; x<5; x++) { myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (10+(x*60), 10, 60+(x*60), 60); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (10+(x*60), 10, 60+(x*60), 60); myGLCD.printNumI(x+1, 27+(x*60), 27); } // Draw the center row of buttons for (x=0; x<5; x++) { myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (10+(x*60), 70, 60+(x*60), 120); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (10+(x*60), 70, 60+(x*60), 120); if (x<4) myGLCD.printNumI(x+6, 27+(x*60), 87); } myGLCD.print("0", 267, 87); // Draw the lower row of buttons myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (10, 130, 150, 180); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (10, 130, 150, 180); myGLCD.print("Clear", 40, 147); myGLCD.setColor(0, 0, 255); myGLCD.fillRoundRect (160, 130, 300, 180); myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect (160, 130, 300, 180); myGLCD.print("Enter", 190, 147); myGLCD.setBackColor (0, 0, 0); }
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>=10) && (y<=60)) // Upper row { if ((x>=10) && (x<=60)) // Button: 1 { waitForIt(10, 10, 60, 60); updateStr('1'); } if ((x>=70) && (x<=120)) // Button: 2 { waitForIt(70, 10, 120, 60); updateStr('2'); } if ((x>=130) && (x<=180)) // Button: 3 { waitForIt(130, 10, 180, 60); updateStr('3'); } if ((x>=190) && (x<=240)) // Button: 4 { waitForIt(190, 10, 240, 60); updateStr('4'); } if ((x>=250) && (x<=300)) // Button: 5 { waitForIt(250, 10, 300, 60); updateStr('5'); } }
if ((y>=70) && (y<=120)) // Center row { if ((x>=10) && (x<=60)) // Button: 6 { waitForIt(10, 70, 60, 120); updateStr('6'); } if ((x>=70) && (x<=120)) // Button: 7 { waitForIt(70, 70, 120, 120); updateStr('7'); } if ((x>=130) && (x<=180)) // Button: 8 { waitForIt(130, 70, 180, 120); updateStr('8'); } if ((x>=190) && (x<=240)) // Button: 9 { waitForIt(190, 70, 240, 120); updateStr('9'); } if ((x>=250) && (x<=300)) // Button: 0 { waitForIt(250, 70, 300, 120); updateStr('0'); } }
if ((y>=130) && (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); } } } } } }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 469
what?
|
 |
« Reply #13 on: August 20, 2012, 05:33:17 pm » |
I may not have explained it well before, you only need to initLCD & initTouch once, you have done it twice here, myGLCD.InitLCD(PORTRAIT); myTouch.InitTouch(PORTRAIT); // Initial setup myGLCD.InitLCD(LANDSCAPE); myGLCD.clrScr();
myTouch.InitTouch(LANDSCAPE); myTouch.setPrecision(PREC_MEDIUM); The Calibration sketch only seems to work in Portrait, after you have done the calibration you can use the screen however you want
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 236
Arduino rocks
|
 |
« Reply #14 on: August 22, 2012, 11:03:19 am » |
have took those to top lines off and still not working
|
|
|
|
|
Logged
|
|
|
|
|
|