Download tetris 240x320 touchscreen




















The fillRect function draws a filled rectangle in x and y locations. The drawRect function draws a rectangle in x and y location with w width and h height and t color. The fillRoundRect function draws a filled Rectangle with r radius round corners in x and y location and w width and h height and t color. The drawRoundRect function draws a Rectangle with r radius round corners in x and y location and w width and h height and t color. The drawCircle function draws a circle in x and y location and r radius and t color.

The fillCircle function draws a filled circle in x and y location and r radius and t color. The drawTriangle function draws a triangle with three corner location x, y and z, and t color. The fillTriangle function draws a filled triangle with three corner location x, y and z, and t color. The following function rotates the screen by given angle.

The following function inverts the colors of the screen. The following function scroll the screen. The Maxroll is the maximum height of your scrolling. The following function resets the screen. Then, lines, circles, rectangles, and squares are drawn on the screen.

The project ends with a greeting and a message. You must be logged in to post a comment. Questions related to this article? Tell Us What You Think!! Cancel reply You must be logged in to post a comment. To prevent this I added some delays and the X and Y analog value is read repeatedly and touch is approved only if values do not differ a lot.

Sorry, something went wrong. I'm trying to rewrite this one for the micropython but I number I read after command 0xd3 are all the same and not , any idea what i'm missing? Skip to content.

Sign in Sign up. Instantly share code, notes, and snippets. Last active Jul 17, Code Revisions 21 Stars 6 Forks 4. Embed What would you like to do? Embed Embed this gist in your website. Share Copy sharable link for this gist. Learn more about clone URLs. Download ZIP. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below.

To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters. Copy link. OUT def read self : self. In this lcd i dont find spi sclk , how to use it.? This is the part that often causes the most trouble with many owners giving up at this point. It may be because there are several different configurations of the pins used to connect to the touch layers of the screen on the many varied breakout boards and shields using this display.

In this case four of the pins are used, at different times, to control both the graphics or the touch elements of the screen. This is a resistive touch screen, rather than a capacitive one. Above the graphics, layers are two transparent resistive layers held apart by tiny dimples.

One is connected at the top and bottom and the other at the sides. A potential difference is applied across them and when the stylus or a finger presses on the screen an electrical connection is made between the resistive layers.

The Analog pins are used to measure the voltages at that point on the two resistive layers, one at a time, in the same manner as we read the voltage from the wiper of a potentiometer — a potential divider. Using these values, it is possible to calculate, quite accurately, the coordinates of the point on the screen where the pressure has been applied.

Calibration is often needed to improve accuracy. On my board, I got Ohms. Try running the sketch to draw on the screen. As a final example here is a sketch which shows off the Touch screen with buttons, bar graphs and colours. The buttons allow the user to adjust the RGB mix to display all the possible colours available. If you find one you particularly like it displays the hex value of the bit colour.

Gently pressing on the buttons at the bottom with the stylus changes the RGB values within their allowed ranges. The bars move to show the fraction of maximum possible for each of the red, green and blue values. There is a small amount of jitter as the bar graph re-draws but overall, the shield works quickly and very well.

After the screen has updated and waiting for a touch the image is steady, sharp, and bright. The SD card reader is a bonus, and could always be used, via jump wires, to record values from sensors on the other pins. These values could then be displayed graphically on the display with a different sketch. I was very pleased with the quality of the display and the accuracy of the Touch device.



0コメント

  • 1000 / 1000