Show Posts
|
|
Pages: [1] 2
|
|
2
|
International / Deutsch / Re: pinmode wechselschaltung
|
on: April 17, 2013, 02:24:54 pm
|
hi ich will es erweitern if ((x>=190) && (x<=240)) // Button: UMSCHALTUNG GENERATOR / AKKU G digitalWrite(Relais1, HIGH); // turn the LED on (LOW is the voltage level) digitalWrite(Relais2, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 215, 240, 238); } if ((x>=250) && (x<=300)) // Button: UMSCHALTUNG GENERATOR / AKKU A digitalWrite(Relais1, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(Relais2, HIGH); // turn the LED on (LOW is the voltage level) waitForIt(250, 215, 300, 238); dieser teil schaltet nicht der rahmen ist bei mir da wo ich drücke und der rest funzt genauso wie ich es haben möchte nur der letzte teil wo ich 2 pins benöte noch nicht marko
|
|
|
|
|
3
|
International / Deutsch / Re: pinmode wechselschaltung
|
on: April 17, 2013, 10:07:34 am
|
Hi hier der komplette sketch Das Relais1 und Relais2 sollen immer im wechsel geschaltet werden // ITDB02_Touch_Button // 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. //
#include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t BigFont[];// 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; int Relais7 = 7;
// 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(BigFont); //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); pinMode(Relais7, OUTPUT); // Draw the upper row of buttons for (x=0; x<6; x++); { myGLCD.setBackColor (0, 0, 0); myGLCD.setColor(255, 255, 255); myGLCD.fillRoundRect (190, 15, 240, 40); myGLCD.drawRoundRect (190, 15, 240, 40); myGLCD.print("BAD&KUECHE", 10, 20); myGLCD.print("ON", 200, 20); myGLCD.fillRoundRect (250, 15, 300, 40); myGLCD.drawRoundRect (250, 15, 300, 40); myGLCD.print("OFF", 250, 20); myGLCD.print("WOHN", 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("AUSSEN", 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("RADIO", 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("TERRASSE", 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("UMSCHALTUNG", 10, 220); myGLCD.fillRoundRect (190, 215, 240, 239); myGLCD.drawRoundRect (190, 215, 240, 239); myGLCD.print("G", 200, 220); myGLCD.fillRoundRect (250, 215, 300, 239); myGLCD.drawRoundRect (250, 215, 300, 239); myGLCD.print(" A ", 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); } { } } // 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<=40)) // Upper row { if ((x>=190) && (x<=240)) // Button: Bad & KÜCHE ON { digitalWrite(Relais5, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 15, 240, 40); } if ((x>=250) && (x<=300)) // Button: Bad & KÜCHE OFF digitalWrite(Relais5, HIGH); // turn the LED on (HIGH is the voltage level) waitForIt(250, 15, 300, 40); } { if ((y>=55) && (y<=80)) // Upper row { if ((x>=190) && (x<=240)) // Button: WOHN ON { digitalWrite(Relais6, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 55, 240, 80); } if ((x>=250) && (x<=300)) // Button: WOHN OFF digitalWrite(Relais6, HIGH); // turn the LED on (HIGH is the voltage level) waitForIt(250, 55, 300, 80); } if ((y>=95) && (y<=120)) // Upper row { if ((x>=190) && (x<=240)) // Button: AUSSEN ON { digitalWrite(Relais3, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 95, 240, 120); } if ((x>=250) && (x<=300)) // Button: AUSSEN OFF digitalWrite(Relais3, HIGH); // turn the LED on (HIGH is the voltage level) waitForIt(250, 95, 300, 120); } if ((y>=135) && (y<=160)) // Upper row { if ((x>=190) && (x<=240)) // Button: RADIO ON { digitalWrite(Relais4, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 135, 240, 160); } if ((x>=250) && (x<=300)) // Button: RADIO OFF digitalWrite(Relais4, HIGH); // turn the LED on (HIGH is the voltage level) waitForIt(250, 135, 300, 160); } if ((y>=175) && (y<=200)) // Upper row { if ((x>=190) && (x<=240)) // Button: TERRASSE ON { digitalWrite(Relais7, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 175, 240, 200); } if ((x>=250) && (x<=300)) // Button: TERRASSE OFF digitalWrite(Relais7, HIGH); // turn the LED on (HIGH is the voltage level) waitForIt(250, 175, 300, 200); } if ((y>=215) && (y<=238)) // Upper row { [u][i][b] if ((x>=190) && (x<=240)) // Button: UMSCHALTUNG GENERATOR / AKKU G digitalWrite(Relais1, HIGH); // turn the LED on (LOW is the voltage level) digitalWrite(Relais2, LOW); // turn the LED on (HIGH is the voltage level) waitForIt(190, 215, 240, 238); } if ((x>=250) && (x<=300)) // Button: UMSCHALTUNG GENERATOR / AKKU A digitalWrite(Relais1, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(Relais2, HIGH); // turn the LED on (LOW is the voltage level) waitForIt(250, 215, 300, 238);[/b][/i][/u] } } } } } [EDIT] bitte den code-Tag (#) verwenden und nicht den sub-Tag. Uwe [/EDIT]
|
|
|
|
|
5
|
International / Deutsch / pinmode wechselschaltung
|
on: April 17, 2013, 02:36:46 am
|
|
hallo
ich hab ein Arduino 2560 mit 3,2" Touch alles funktioniert soweit. ich möchte nur das zb. beim drücken des touch auf ein button (pin12 Low) und (pin11 high) ist und wenn ich auf den anderen button drücke gewechselt wird so das immer der eine low der andere high ist.
vielen dank im voraus
|
|
|
|
|
8
|
International / Deutsch / Re: output pins richtig deklarieren
|
on: November 11, 2012, 06:59:51 am
|
#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); } } } } } } }
|
|
|
|
|
9
|
International / Deutsch / output pins richtig deklarieren
|
on: November 11, 2012, 06:24:01 am
|
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
|
|
|
|
|
11
|
International / Deutsch / TFT Push Buttons
|
on: October 30, 2012, 01:27:00 am
|
hallo jetzt hab ich alles soweit das es aussieht wie ich es haben möchte Touch und eine Relaiskarte die mir dann alles schaltet nur habe ich ein problem wie kann man die buttons auf den display genau positionieren denn zur zeit gehen alle relais zusammen an und aus die schrift passt nur die Push buttons anscheinen nicht könnt ihr mir da helfen mein script: #include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t BigFont[];// 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(BigFont); 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<8; 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, 145, 240, 160); myGLCD.drawRoundRect (190, 145, 240, 160); myGLCD.print("ON", 200, 140); myGLCD.fillRoundRect (250, 145, 300, 160); myGLCD.drawRoundRect (250, 145, 300, 160); myGLCD.print("OFF", 250, 140); myGLCD.print("RADIO", 10, 180); myGLCD.fillRoundRect (190, 195, 240, 200); myGLCD.drawRoundRect (190, 195, 240, 200); myGLCD.print("ON", 200, 180); // myGLCD.fillRoundRect (190, 15, 240, 40); // myGLCD.drawRoundRect (190, 15, 240, 40); myGLCD.print("OFF", 250, 180); myGLCD.print("LEER", 10, 220); // myGLCD.fillRoundRect (190, 15, 240, 40); // myGLCD.drawRoundRect (190, 15, 240, 40); myGLCD.print("ON", 200, 220); // myGLCD.fillRoundRect (190, 15, 240, 40); // myGLCD.drawRoundRect (190, 15, 240, 40); myGLCD.print("OFF", 250, 220); } //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>=15) && (y<=120)) // 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, 145, 240, 160); } if ((x>=250) && (x<=300)) // Button: POOL OFF digitalWrite(Relais4, HIGH); // turn the LED on (HIGH is the voltage level) { waitForIt(250, 145, 300, 160); } if ((x>=190) && (x<=240)) // Button: Radio ON digitalWrite(Relais5, LOW); // turn the LED on (HIGH is the voltage level) { waitForIt(190, 195, 240, 200); } if ((x>=250) && (x<=300)) // Button: Radio OFF digitalWrite(Relais5, HIGH); // turn the LED on (HIGH is the voltage level) { waitForIt(250, 195, 300, 200); } }
//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); } } } } } } } } danke
|
|
|
|
|
12
|
International / Deutsch / Re: TFT von SaintSmart ansteuerung
|
on: October 27, 2012, 03:25:57 am
|
So das Display geht Jetzt habe ich nur noch eine Frage wie Kann ich text schreiben?? // ITDB02_Touch_ButtonTest (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // Modified to work with UTFT on Mega w/Arduino 1.0.1 (C)2012 Otmar Ebenhoech, // // 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. //
#include <UTFT.h> #include <ITDB02_Touch.h>
// Declare which fonts we will be using extern uint8_t BigFont[];// 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(BigFont); 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<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 digitalWrite(Relais1, LOW); // turn the LED on (HIGH is the voltage level) { // waitForIt(10, 10, 60, 60); // updateStr('1'); } if ((x>=70) && (x<=120)) // Button: 2 digitalWrite(Relais1, HIGH); // turn the LED on (HIGH is the voltage level) { // waitForIt(70, 10, 120, 60); // updateStr('2'); } if ((x>=130) && (x<=180)) // Button: 3 digitalWrite(Relais2, LOW); // turn the LED on (HIGH is the voltage level) { waitForIt(130, 10, 180, 60); updateStr('3'); } if ((x>=190) && (x<=240)) // Button: 4 digitalWrite(Relais2, HIGH); // turn the LED on (HIGH is the voltage level) { waitForIt(190, 10, 240, 60); updateStr('4'); } if ((x>=250) && (x<=300)) // Button: 5 digitalWrite(Relais3, LOW); // turn the LED on (HIGH is the voltage level) { waitForIt(250, 10, 300, 60); updateStr('5'); } }
if ((y>=70) && (y<=120)) // Center row { if ((x>=10) && (x<=60)) // Button: 6 digitalWrite(Relais3, HIGH); // turn the LED on (HIGH is the voltage level) { // waitForIt(10, 70, 60, 120); // updateStr('6'); } if ((x>=70) && (x<=120)) // Button: 7 digitalWrite(Relais4, LOW); // turn the LED on (HIGH is the voltage level) { // waitForIt(70, 70, 120, 120); // updateStr('7'); } if ((x>=130) && (x<=180)) // Button: 8 digitalWrite(Relais4, HIGH); // turn the LED on (HIGH is the voltage level) { // waitForIt(130, 70, 180, 120); // updateStr('8'); } if ((x>=190) && (x<=240)) // Button: 9 digitalWrite(Relais5, LOW); // turn the LED on (HIGH is the voltage level) { waitForIt(190, 70, 240, 120); updateStr('9'); } if ((x>=250) && (x<=300)) // Button: 0 digitalWrite(Relais5, HIGH); // turn the LED on (HIGH is the voltage level) { 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); } } } } } } [EDIT] Hab Code-Tags hinzugehügt. Grüße Uwe [EDIT/]
|
|
|
|
|
13
|
International / Deutsch / Re: TFT von SaintSmart ansteuerung
|
on: October 26, 2012, 02:26:16 pm
|
|
da bekomme ich noch mehr fehler
In file included from ITDB02_Touch_ButtonTest.cpp:15: C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:52:22: error: WProgram.h: No such file or directory In file included from ITDB02_Touch_ButtonTest.cpp:15: C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:56: error: ISO C++ forbids declaration of 'uint8_t' with no type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:56: error: expected ';' before '*' token C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:57: error: 'uint8_t' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:58: error: 'uint8_t' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:59: error: 'uint8_t' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:60: error: 'uint8_t' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:67: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:68: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:72: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:72: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:72: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:79: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:79: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:79: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:80: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:80: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:80: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:83: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:84: error: 'uint8_t' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:89: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:90: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:91: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:92: error: ISO C++ forbids declaration of 'uint8_t' with no type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:92: error: expected ';' before '*' token C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:93: error: 'uint8_t' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:95: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:101: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:101: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:101: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:104: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:106: error: 'byte' has not been declared In file included from ITDB02_Touch_ButtonTest.cpp:16: C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:57: error: 'word' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:59: error: expected `)' before 'tclk' C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:61: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:66: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:69: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:70: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:71: error: 'byte' does not name a type C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:73: error: 'byte' has not been declared C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:74: error: 'word' does not name a type ITDB02_Touch_ButtonTest.pde:-1: error: no matching function for call to 'ITDB02_Touch::ITDB02_Touch(int, int, int, int, int)' C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:55: note: candidates are: ITDB02_Touch::ITDB02_Touch() C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Touch.h:55: note: ITDB02_Touch::ITDB02_Touch(const ITDB02_Touch&) ITDB02_Touch_ButtonTest.cpp: In function 'void setup()': ITDB02_Touch_ButtonTest.pde:-1: error: no matching function for call to 'ITDB02::setFont(uint8_t [])' C:\Dokumente und Einstellungen\priv\Desktop\arduino-1.0.1\libraries\ITDB02_Touch/ITDB02_Graph.h:84: note: candidates are: void ITDB02::setFont(int*)
and
no matching funktion for call to ITDB02_Touch: ITDB02_Touch(int,int,int,int)
|
|
|
|
|
14
|
International / Deutsch / Re: TFT von SaintSmart ansteuerung
|
on: October 26, 2012, 01:40:19 pm
|
|
jetzt kommt diese meldung :-(
ITDB02_Touch_ButtonTest.cpp.o: In function `setup': C:\Temp\build6312532056827934767.tmp/ITDB02_Touch_ButtonTest.cpp:48: undefined reference to `BigFont' C:\Temp\build6312532056827934767.tmp/ITDB02_Touch_ButtonTest.cpp:48: undefined reference to `BigFont'
C:\Dokumente und Einstellungen\priv\Desktop\arduino-0023\hardware\tools\avr\bin\avr-ar: pins_arduino.c.o: No such file or directory
|
|
|
|
|