Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
 
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Background and Draw Box/Window commands

Hello,

I want to display on the 2.2" Color Graphic TFT display this simple 2 scenes but I am having too much problem to really understand the way that the mydisp.setBgColor works.

Here they are:

 

I wanna be able to bring this square (red on the picture) on the display and also erase it. And also change the color of the Background.

1. Can someone put here a small code whith this functions?

2. Is there a clever way to display a text on the center of the display?

Thank you very much!

 

RE:Background and Draw Box/Window commands

 Use draw window if the firmware on your module is V3.2 and newer, otherwise, you need draw a filled rectangle, then print text in this rectangle.

you need to calculate the position of text if you want it aligned at the center of a rectangle

RE:Background and Draw Box/Window commands

Thanks for the quick answer. Figured out to do it, but maybe is a better way to do it?

Here is a video of the result:

https://sendvid.com/o8nuu589

Here is my code:

 #include <Wire.h> //I don't know why I have to include this, but without it won't compile


#define _Digole_Serial_SPI_  //To tell compiler compile the special communication only,
//all available are:_Digole_Serial_UART_, _Digole_Serial_I2C_ and _Digole_Serial_SPI_
#include <DigoleSerial.h>

//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp1(11,13,2);  //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
DigoleSerialDisp mydisp2(11,13,3);
#endif
#define SC_W 176  //screen width in pixels
#define SC_H 220  //screen Hight in pixels

void setup() {
  mydisp1.begin();
  mydisp1.clearScreen(); //CLear screen
  mydisp1.setBackLight(70);
 
 
  mydisp2.begin();
  mydisp2.clearScreen(); //CLear screen
  mydisp2.setBackLight(70);
}

void loop() {

mydisp1.clearScreen();

mydisp1.setDrawWindow(0, 0, 176, 220);
mydisp1.setColor(50);
mydisp1.setBgColor();

mydisp1.cleanDrawWindow();

mydisp1.setRotation(45);
mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,2);
mydisp1.print("  CHORUS");

mydisp2.clearScreen();

mydisp2.setDrawWindow(0, 0, 176, 220);
mydisp2.setColor(255255000);
mydisp2.setBgColor();

mydisp2.cleanDrawWindow();

mydisp2.setRotation(45);
mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(5,2);
mydisp2.print("OVERDRIVE");

//mydisp2.clearScreen();

delay(5000);

mydisp1.setRotation(45);
mydisp1.setDrawWindow(15, 15, 190, 150);
mydisp1.setColor(255000000);
mydisp1.setBgColor();

mydisp1.cleanDrawWindow();

mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,1);
mydisp1.print(" CHORUS ");

mydisp2.setRotation(45);
mydisp2.setDrawWindow(15, 15, 190, 150);
mydisp2.setColor(255000000);
mydisp2.setBgColor();

mydisp2.cleanDrawWindow();

mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(2,1);
mydisp2.print(" OVERDRIVE ");

delay(5000);
mydisp1.setColor(000000000);
mydisp1.setBgColor();

mydisp2.setColor(000000000);
mydisp2.setBgColor();

}

Copyright Digole Digital Solutions, 2008-2017. All rights reserved.
Powered by Victor Sun