Hello dear 4D Systems team and 4D Users!
I getting started with IoD modules and i have an issue(and another but that fits another topic.).
I declared six buttons and a textwindow. When i touch the buttons on the screen one after another (or one button) too fast, the whole modul get freeze.
I use arduino 1.8.3 and version 2.4.0 of esp lbrary. I trierd to use different type of technics to make it and all of them get the same result. I tried to add some delay but no luck.
Is there anybody who faced with this issue? Or somebody who can help me where/what i wrote badly?
Thank You!
Robert
Here is the code that i made:
#include "ESP8266WiFi.h"
#include "GFX4d.h"
uint8_t buttw;
int but;
int lastbut;
GFX4d gfx = GFX4d();
void setup() {
Serial.begin(115200);
gfx.begin();
gfx.Cls();
gfx.ScrollEnable(true);
gfx.BacklightOn(true);
gfx.Orientation(LANDSCAPE_R);
gfx.SmoothScrollSpeed(5);
gfx.touch_Set(TOUCH_ENABLE);
gfx.TextColor(WHITE); gfx.Font(2); gfx.TextSize(1);
gfx.TextWindow(0,0, 320,100, BLACK, SILVER, DARKGRAY);
gfx.Buttonx(33, 10, 150, 40, 40, SILVER, "1", 1, BLACK);
gfx.Buttonx(34, 60, 150, 40, 40, SILVER, "2", 1, BLACK);
gfx.Buttonx(35, 110, 150, 40, 40, SILVER, "3", 1, BLACK);
gfx.Buttonx(36, 160, 150, 40, 40, SILVER, "4", 1, BLACK);
gfx.Buttonx(37, 210, 150, 40, 40, SILVER, "5", 1, BLACK);
gfx.Buttonx(38, 260, 150, 40, 40, SILVER, "6", 1, BLACK);
}
void loop() {
//1st version
//buttw = gfx.CheckButtons();
// if(buttw != lastbut && buttw > 0){
// but = buttw;
// switch(but){
// case 33:gfx.TWcls();gfx.TWprintln("1");break;
// case 34:gfx.TWcls();gfx.TWprintln("2");break;
// case 35:gfx.TWcls();gfx.TWprintln("3");break;
// case 36:gfx.TWcls();gfx.TWprintln("4");break;
// case 37:gfx.TWcls();gfx.TWprintln("5");break;
// case 38:gfx.TWcls();gfx.TWprintln("6");break;
// }
// }else{but = 0;}
// lastbut = buttw;
//2nd version
//buttw = gfx.CheckButtons();
// if(buttw != lastbut && buttw > 0&&buttw<255){Serial.println(buttw);delayMicroseconds(14000);//delay(14);
// but = buttw;gfx.TWcls();
// if(but == 33){
// gfx.TWprintln("1");
// }
// if(but == 34){
// gfx.TWprintln("2");
// }
// if(but == 35){
// gfx.TWprintln("3");
// }
// if(but == 36){
// gfx.TWprintln("4");
// }
// if(but == 37){
// gfx.TWprintln("5");
// }
// if(but == 38){
// gfx.TWprintln("6");
// }
// } else {
// but = 0;delayMicroseconds(14000);//delay(14);
// }
// lastbut = buttw;
//3rd version
buttw = gfx.CheckButtons();
switch(buttw){
case 33:gfx.TWcls();gfx.TWprintln("1");break;
case 34:gfx.TWcls();gfx.TWprintln("2");break;
case 35:gfx.TWcls();gfx.TWprintln("3");break;
case 36:gfx.TWcls();gfx.TWprintln("4");break;
case 37:gfx.TWcls();gfx.TWprintln("5");break;
case 38:gfx.TWcls();gfx.TWprintln("6");break;
}
yield();
}
I getting started with IoD modules and i have an issue(and another but that fits another topic.).
I declared six buttons and a textwindow. When i touch the buttons on the screen one after another (or one button) too fast, the whole modul get freeze.
I use arduino 1.8.3 and version 2.4.0 of esp lbrary. I trierd to use different type of technics to make it and all of them get the same result. I tried to add some delay but no luck.
Is there anybody who faced with this issue? Or somebody who can help me where/what i wrote badly?
Thank You!
Robert
Here is the code that i made:
#include "ESP8266WiFi.h"
#include "GFX4d.h"
uint8_t buttw;
int but;
int lastbut;
GFX4d gfx = GFX4d();
void setup() {
Serial.begin(115200);
gfx.begin();
gfx.Cls();
gfx.ScrollEnable(true);
gfx.BacklightOn(true);
gfx.Orientation(LANDSCAPE_R);
gfx.SmoothScrollSpeed(5);
gfx.touch_Set(TOUCH_ENABLE);
gfx.TextColor(WHITE); gfx.Font(2); gfx.TextSize(1);
gfx.TextWindow(0,0, 320,100, BLACK, SILVER, DARKGRAY);
gfx.Buttonx(33, 10, 150, 40, 40, SILVER, "1", 1, BLACK);
gfx.Buttonx(34, 60, 150, 40, 40, SILVER, "2", 1, BLACK);
gfx.Buttonx(35, 110, 150, 40, 40, SILVER, "3", 1, BLACK);
gfx.Buttonx(36, 160, 150, 40, 40, SILVER, "4", 1, BLACK);
gfx.Buttonx(37, 210, 150, 40, 40, SILVER, "5", 1, BLACK);
gfx.Buttonx(38, 260, 150, 40, 40, SILVER, "6", 1, BLACK);
}
void loop() {
//1st version
//buttw = gfx.CheckButtons();
// if(buttw != lastbut && buttw > 0){
// but = buttw;
// switch(but){
// case 33:gfx.TWcls();gfx.TWprintln("1");break;
// case 34:gfx.TWcls();gfx.TWprintln("2");break;
// case 35:gfx.TWcls();gfx.TWprintln("3");break;
// case 36:gfx.TWcls();gfx.TWprintln("4");break;
// case 37:gfx.TWcls();gfx.TWprintln("5");break;
// case 38:gfx.TWcls();gfx.TWprintln("6");break;
// }
// }else{but = 0;}
// lastbut = buttw;
//2nd version
//buttw = gfx.CheckButtons();
// if(buttw != lastbut && buttw > 0&&buttw<255){Serial.println(buttw);delayMicroseconds(14000);//delay(14);
// but = buttw;gfx.TWcls();
// if(but == 33){
// gfx.TWprintln("1");
// }
// if(but == 34){
// gfx.TWprintln("2");
// }
// if(but == 35){
// gfx.TWprintln("3");
// }
// if(but == 36){
// gfx.TWprintln("4");
// }
// if(but == 37){
// gfx.TWprintln("5");
// }
// if(but == 38){
// gfx.TWprintln("6");
// }
// } else {
// but = 0;delayMicroseconds(14000);//delay(14);
// }
// lastbut = buttw;
//3rd version
buttw = gfx.CheckButtons();
switch(buttw){
case 33:gfx.TWcls();gfx.TWprintln("1");break;
case 34:gfx.TWcls();gfx.TWprintln("2");break;
case 35:gfx.TWcls();gfx.TWprintln("3");break;
case 36:gfx.TWcls();gfx.TWprintln("4");break;
case 37:gfx.TWcls();gfx.TWprintln("5");break;
case 38:gfx.TWcls();gfx.TWprintln("6");break;
}
yield();
}
Comment