TFT SPI 240 x 320 Com Esp8266 ou Arduino - Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)2024-03-28T22:16:11Zhttps://labdegaragem.com/forum/topics/tft-spi-240-x-320-com-esp8266-ou-arduino-1?commentId=6223006%3AComment%3A608218&x=1&feed=yes&xn_auth=noAgora eu estou fazendo testes…tag:labdegaragem.com,2017-04-21:6223006:Comment:6082182017-04-21T01:43:17.266ZFabricio Valehttps://labdegaragem.com/profile/FabricioVale
<p>Agora eu estou fazendo testes com nodemcu Esp8266. Não estou achando um esquema eletrônico correto. Vou continuar dando uma procurada. José tem como me ajuda nessa?</p>
<p>Agora eu estou fazendo testes com nodemcu Esp8266. Não estou achando um esquema eletrônico correto. Vou continuar dando uma procurada. José tem como me ajuda nessa?</p> Que beleza !
Sabia que o sit…tag:labdegaragem.com,2017-04-14:6223006:Comment:6071412017-04-14T00:21:13.431ZJosé Gustavo Abreu Murtahttps://labdegaragem.com/profile/GustavoMurta
<p>Que beleza ! </p>
<p>Sabia que o site da Adafruit poderia te ajudar .</p>
<p>O pessoal da ADAFRUIT é muito competente.</p>
<p>Que beleza ! </p>
<p>Sabia que o site da Adafruit poderia te ajudar .</p>
<p>O pessoal da ADAFRUIT é muito competente.</p> Pessoal depois de muito estud…tag:labdegaragem.com,2017-04-13:6223006:Comment:6069782017-04-13T01:21:02.393ZFabricio Valehttps://labdegaragem.com/profile/FabricioVale
<p>Pessoal depois de muito estudos e supletivos rs....finalmente eu consegui</p>
<p></p>
<p>Então segue o código do TFT ILI9341 que eu utilizei</p>
<p></p>
<p>#include "SPI.h"<br></br>#include "Adafruit_GFX.h"<br></br>#include "Adafruit_ILI9341.h"</p>
<p>// For the Adafruit shield, these are the default.<br></br>#define TFT_DC 2<br></br>#define TFT_CS 3<br></br>#define TFT_MOSI 4<br></br>#define TFT_CLK 5<br></br>#define TFT_RST 6<br></br>#define TFT_MISO 7</p>
<p>// Use hardware SPI (on Uno, #13, #12, #11) and the above for…</p>
<p>Pessoal depois de muito estudos e supletivos rs....finalmente eu consegui</p>
<p></p>
<p>Então segue o código do TFT ILI9341 que eu utilizei</p>
<p></p>
<p>#include "SPI.h"<br/>#include "Adafruit_GFX.h"<br/>#include "Adafruit_ILI9341.h"</p>
<p>// For the Adafruit shield, these are the default.<br/>#define TFT_DC 2<br/>#define TFT_CS 3<br/>#define TFT_MOSI 4<br/>#define TFT_CLK 5<br/>#define TFT_RST 6<br/>#define TFT_MISO 7</p>
<p>// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC<br/>//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);<br/>// If using the breakout, change pins as desired<br/>Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);</p>
<p>void setup() {<br/> Serial.begin(9600);<br/> Serial.println("ILI9341 Test!"); <br/> <br/> tft.begin();</p>
<p>// read diagnostics (optional but can help debug problems)<br/> uint8_t x = tft.readcommand8(ILI9341_RDMODE);<br/> Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);<br/> x = tft.readcommand8(ILI9341_RDMADCTL);<br/> Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);<br/> x = tft.readcommand8(ILI9341_RDPIXFMT);<br/> Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);<br/> x = tft.readcommand8(ILI9341_RDIMGFMT);<br/> Serial.print("Image Format: 0x"); Serial.println(x, HEX);<br/> x = tft.readcommand8(ILI9341_RDSELFDIAG);<br/> Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); <br/> <br/> Serial.println(F("Benchmark Time (microseconds)"));<br/> delay(10);<br/> Serial.print(F("Screen fill "));<br/> Serial.println(testFillScreen());<br/> delay(500);</p>
<p>Serial.print(F("Text "));<br/> Serial.println(testText());<br/> delay(3000);</p>
<p>Serial.print(F("Lines "));<br/> Serial.println(testLines(ILI9341_CYAN));<br/> delay(500);</p>
<p>Serial.print(F("Horiz/Vert Lines "));<br/> Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));<br/> delay(500);</p>
<p>Serial.print(F("Rectangles (outline) "));<br/> Serial.println(testRects(ILI9341_GREEN));<br/> delay(500);</p>
<p>Serial.print(F("Rectangles (filled) "));<br/> Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));<br/> delay(500);</p>
<p>Serial.print(F("Circles (filled) "));<br/> Serial.println(testFilledCircles(10, ILI9341_MAGENTA));</p>
<p>Serial.print(F("Circles (outline) "));<br/> Serial.println(testCircles(10, ILI9341_WHITE));<br/> delay(500);</p>
<p>Serial.print(F("Triangles (outline) "));<br/> Serial.println(testTriangles());<br/> delay(500);</p>
<p>Serial.print(F("Triangles (filled) "));<br/> Serial.println(testFilledTriangles());<br/> delay(500);</p>
<p>Serial.print(F("Rounded rects (outline) "));<br/> Serial.println(testRoundRects());<br/> delay(500);</p>
<p>Serial.print(F("Rounded rects (filled) "));<br/> Serial.println(testFilledRoundRects());<br/> delay(500);</p>
<p>Serial.println(F("Done!"));</p>
<p>}</p>
<p><br/>void loop(void) {<br/> for(uint8_t rotation=0; rotation<4; rotation++) {<br/> tft.setRotation(rotation);<br/> testText();<br/> delay(1000);<br/> }<br/>}</p>
<p>unsigned long testFillScreen() {<br/> unsigned long start = micros();<br/> tft.fillScreen(ILI9341_BLACK);<br/> yield();<br/> tft.fillScreen(ILI9341_RED);<br/> yield();<br/> tft.fillScreen(ILI9341_GREEN);<br/> yield();<br/> tft.fillScreen(ILI9341_BLUE);<br/> yield();<br/> tft.fillScreen(ILI9341_BLACK);<br/> yield();<br/> return micros() - start;<br/>}</p>
<p>unsigned long testText() {<br/> tft.fillScreen(ILI9341_BLACK);<br/> unsigned long start = micros();<br/> tft.setCursor(0, 0);<br/> tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);<br/> tft.println("Hello World!");<br/> tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);<br/> tft.println(1234.56);<br/> tft.setTextColor(ILI9341_RED); tft.setTextSize(3);<br/> tft.println(0xDEADBEEF, HEX);<br/> tft.println();<br/> tft.setTextColor(ILI9341_GREEN);<br/> tft.setTextSize(5);<br/> tft.println("Groop");<br/> tft.setTextSize(2);<br/> tft.println("I implore thee,");<br/> tft.setTextSize(1);<br/> tft.println("my foonting turlingdromes.");<br/> tft.println("And hooptiously drangle me");<br/> tft.println("with crinkly bindlewurdles,");<br/> tft.println("Or I will rend thee");<br/> tft.println("in the gobberwarts");<br/> tft.println("with my blurglecruncheon,");<br/> tft.println("see if I don't!");<br/> return micros() - start;<br/>}</p>
<p>unsigned long testLines(uint16_t color) {<br/> unsigned long start, t;<br/> int x1, y1, x2, y2,<br/> w = tft.width(),<br/> h = tft.height();</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> yield();<br/> <br/> x1 = y1 = 0;<br/> y2 = h - 1;<br/> start = micros();<br/> for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> x2 = w - 1;<br/> for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> t = micros() - start; // fillScreen doesn't count against timing</p>
<p>yield();<br/> tft.fillScreen(ILI9341_BLACK);<br/> yield();</p>
<p>x1 = w - 1;<br/> y1 = 0;<br/> y2 = h - 1;<br/> start = micros();<br/> for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> x2 = 0;<br/> for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> t += micros() - start;</p>
<p>yield();<br/> tft.fillScreen(ILI9341_BLACK);<br/> yield();</p>
<p>x1 = 0;<br/> y1 = h - 1;<br/> y2 = 0;<br/> start = micros();<br/> for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> x2 = w - 1;<br/> for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> t += micros() - start;</p>
<p>yield();<br/> tft.fillScreen(ILI9341_BLACK);<br/> yield();</p>
<p>x1 = w - 1;<br/> y1 = h - 1;<br/> y2 = 0;<br/> start = micros();<br/> for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);<br/> x2 = 0;<br/> for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);</p>
<p>yield();<br/> return micros() - start;<br/>}</p>
<p>unsigned long testFastLines(uint16_t color1, uint16_t color2) {<br/> unsigned long start;<br/> int x, y, w = tft.width(), h = tft.height();</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> start = micros();<br/> for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);<br/> for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);</p>
<p>return micros() - start;<br/>}</p>
<p>unsigned long testRects(uint16_t color) {<br/> unsigned long start;<br/> int n, i, i2,<br/> cx = tft.width() / 2,<br/> cy = tft.height() / 2;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> n = min(tft.width(), tft.height());<br/> start = micros();<br/> for(i=2; i<n; i+=6) {<br/> i2 = i / 2;<br/> tft.drawRect(cx-i2, cy-i2, i, i, color);<br/> }</p>
<p>return micros() - start;<br/>}</p>
<p>unsigned long testFilledRects(uint16_t color1, uint16_t color2) {<br/> unsigned long start, t = 0;<br/> int n, i, i2,<br/> cx = tft.width() / 2 - 1,<br/> cy = tft.height() / 2 - 1;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> n = min(tft.width(), tft.height());<br/> for(i=n; i>0; i-=6) {<br/> i2 = i / 2;<br/> start = micros();<br/> tft.fillRect(cx-i2, cy-i2, i, i, color1);<br/> t += micros() - start;<br/> // Outlines are not included in timing results<br/> tft.drawRect(cx-i2, cy-i2, i, i, color2);<br/> yield();<br/> }</p>
<p>return t;<br/>}</p>
<p>unsigned long testFilledCircles(uint8_t radius, uint16_t color) {<br/> unsigned long start;<br/> int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> start = micros();<br/> for(x=radius; x<w; x+=r2) {<br/> for(y=radius; y<h; y+=r2) {<br/> tft.fillCircle(x, y, radius, color);<br/> }<br/> }</p>
<p>return micros() - start;<br/>}</p>
<p>unsigned long testCircles(uint8_t radius, uint16_t color) {<br/> unsigned long start;<br/> int x, y, r2 = radius * 2,<br/> w = tft.width() + radius,<br/> h = tft.height() + radius;</p>
<p>// Screen is not cleared for this one -- this is<br/> // intentional and does not affect the reported time.<br/> start = micros();<br/> for(x=0; x<w; x+=r2) {<br/> for(y=0; y<h; y+=r2) {<br/> tft.drawCircle(x, y, radius, color);<br/> }<br/> }</p>
<p>return micros() - start;<br/>}</p>
<p>unsigned long testTriangles() {<br/> unsigned long start;<br/> int n, i, cx = tft.width() / 2 - 1,<br/> cy = tft.height() / 2 - 1;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> n = min(cx, cy);<br/> start = micros();<br/> for(i=0; i<n; i+=5) {<br/> tft.drawTriangle(<br/> cx , cy - i, // peak<br/> cx - i, cy + i, // bottom left<br/> cx + i, cy + i, // bottom right<br/> tft.color565(i, i, i));<br/> }</p>
<p>return micros() - start;<br/>}</p>
<p>unsigned long testFilledTriangles() {<br/> unsigned long start, t = 0;<br/> int i, cx = tft.width() / 2 - 1,<br/> cy = tft.height() / 2 - 1;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> start = micros();<br/> for(i=min(cx,cy); i>10; i-=5) {<br/> start = micros();<br/> tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,<br/> tft.color565(0, i*10, i*10));<br/> t += micros() - start;<br/> tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,<br/> tft.color565(i*10, i*10, 0));<br/> yield();<br/> }</p>
<p>return t;<br/>}</p>
<p>unsigned long testRoundRects() {<br/> unsigned long start;<br/> int w, i, i2,<br/> cx = tft.width() / 2 - 1,<br/> cy = tft.height() / 2 - 1;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> w = min(tft.width(), tft.height());<br/> start = micros();<br/> for(i=0; i<w; i+=6) {<br/> i2 = i / 2;<br/> tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));<br/> }</p>
<p>return micros() - start;<br/>}</p>
<p>unsigned long testFilledRoundRects() {<br/> unsigned long start;<br/> int i, i2,<br/> cx = tft.width() / 2 - 1,<br/> cy = tft.height() / 2 - 1;</p>
<p>tft.fillScreen(ILI9341_BLACK);<br/> start = micros();<br/> for(i=min(tft.width(), tft.height()); i>20; i-=6) {<br/> i2 = i / 2;<br/> tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));<br/> yield();<br/> }</p>
<p>return micros() - start;<br/>}</p>
<p></p>
<p>E segue o esquema de ligação para o arduino.</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/1939705437?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/1939705437?profile=RESIZE_1024x1024" width="721" class="align-center"/></a></p>
<p></p>
<p>Então mais um projeto concluido!</p>
<p></p>
<p>Obrigado a todos pela ajuda.</p>
<p></p>
<p>Att</p>
<p></p>
<p>Fabricio Vale</p>
<p></p> boa noite José!
O meu problem…tag:labdegaragem.com,2017-04-12:6223006:Comment:6069592017-04-12T22:41:17.237ZFabricio Valehttps://labdegaragem.com/profile/FabricioVale
<p>boa noite José!</p>
<p>O meu problema seria um esquema correto para ligação ou alguém que no Labgaragem já trabalhou com isso. Ou o meu TFT esta com problemas. Já tentei de tudo e ele não funciona e ele só aparece uma tela em branco.</p>
<p>boa noite José!</p>
<p>O meu problema seria um esquema correto para ligação ou alguém que no Labgaragem já trabalhou com isso. Ou o meu TFT esta com problemas. Já tentei de tudo e ele não funciona e ele só aparece uma tela em branco.</p> Especificações do TFT ILI9341…tag:labdegaragem.com,2017-04-12:6223006:Comment:6069132017-04-12T13:34:12.405ZJosé Gustavo Abreu Murtahttps://labdegaragem.com/profile/GustavoMurta
<p>Especificações do TFT ILI9341I </p>
<p><a href="https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf" target="_blank">https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf</a></p>
<p></p>
<p><a href="https://www.adafruit.com/product/1770" target="_blank">https://www.adafruit.com/product/1770…</a></p>
<p></p>
<p></p>
<p>Especificações do TFT ILI9341I </p>
<p><a href="https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf" target="_blank">https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf</a></p>
<p></p>
<p><a href="https://www.adafruit.com/product/1770" target="_blank">https://www.adafruit.com/product/1770</a></p>
<p></p>
<p><a href="https://learn.adafruit.com/adafruit-2-dot-8-color-tft-touchscreen-breakout-v2" target="_blank">https://learn.adafruit.com/adafruit-2-dot-8-color-tft-touchscreen-breakout-v2</a></p> Não conheço tb nenhum Shield…tag:labdegaragem.com,2017-04-11:6223006:Comment:6069022017-04-11T23:49:11.018ZFabricio Valehttps://labdegaragem.com/profile/FabricioVale
<p>Não conheço tb nenhum Shield pra ele. Alguém conhece ou já mexeu nesse TFT ILI9341?</p>
<p>Não conheço tb nenhum Shield pra ele. Alguém conhece ou já mexeu nesse TFT ILI9341?</p> Por que um projetista faz um…tag:labdegaragem.com,2017-04-11:6223006:Comment:6064982017-04-11T23:47:15.983ZFabricio Valehttps://labdegaragem.com/profile/FabricioVale
<p>Por que um projetista faz um TFT ILI9341 e depois faz agente se matar pra descobrir como fazer esse tipo de ligações em outras placas. Realmente isso é surreal.Realmente não consigo entender </p>
<p></p>
<p>Segue algumas formas de ligação</p>
<p></p>
<p></p>
<p>Por que um projetista faz um TFT ILI9341 e depois faz agente se matar pra descobrir como fazer esse tipo de ligações em outras placas. Realmente isso é surreal.Realmente não consigo entender </p>
<p></p>
<p>Segue algumas formas de ligação</p>
<p></p>
<p></p> Mas nesse caso isso não leva…tag:labdegaragem.com,2017-04-11:6223006:Comment:6067482017-04-11T22:42:34.250ZFabricio Valehttps://labdegaragem.com/profile/FabricioVale
<p>Mas nesse caso isso não leva nenhum resistor?</p>
<p></p>
<p>Mas nesse caso isso não leva nenhum resistor?</p>
<p></p> Olá Fabricio, achei algo para…tag:labdegaragem.com,2017-04-11:6223006:Comment:6064712017-04-11T13:18:14.153Zrhaicmer braulio da costahttps://labdegaragem.com/profile/rhaicmerbrauliodacosta
<p>Olá Fabricio, achei algo para você:</p>
<p></p>
<p><font><font>CS: 10 </font></font><br></br><font><font>DC: 9 </font></font><br></br><font><font>SDI / MOSI: 11 </font></font><br></br><font><font>SCK: 13 </font></font><br></br><font><font>RESET: 8 </font></font><br></br><font><font>SDO / MISO: 12 </font></font></p>
<p></p>
<p><font>Veja se este link te ajuda: …</font></p>
<p>Olá Fabricio, achei algo para você:</p>
<p></p>
<p><font><font>CS: 10 </font></font><br/><font><font>DC: 9 </font></font><br/><font><font>SDI / MOSI: 11 </font></font><br/><font><font>SCK: 13 </font></font><br/><font><font>RESET: 8 </font></font><br/><font><font>SDO / MISO: 12 </font></font></p>
<p></p>
<p><font>Veja se este link te ajuda: <strong><a href="https://forum.arduino.cc/index.php?topic=200126.75" target="_blank">https://forum.arduino.cc/index.php?topic=200126.75</a></strong></font></p>