User Tools

Site Tools


arduino:displays_for_classic_arduinos:1.8_and_1.44_tft_displays_and_classic_arduinos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
arduino:displays_for_classic_arduinos:1.8_and_1.44_tft_displays_and_classic_arduinos [2018/01/28 01:54] – [Arduino TFT library] mithatarduino:displays_for_classic_arduinos:1.8_and_1.44_tft_displays_and_classic_arduinos [2018/01/28 01:56] – [Adafruit ST7735 Library] mithat
Line 61: Line 61:
 FIXME video FIXME video
  
-<file c++ display_st7735_1.44_adafruit_st7735.ino+[[display_st7735_1.44_adafruit_st7735.ino | source code]]
-/* +
- * display_st7735_1.44_adafruit_st7735.ino +
-   +
- * Test screen update speed with large default fonts on  +
- * a 128x128 TFT screen that uses the ST7735 chip. +
- *  +
- * Consumes 26% of program storage space and +
- * 6% of dynamic memory on a Pro Mini. +
- *  +
- * Mithat Konar +
- */ +
- +
-#include <Adafruit_GFX.h>    // Core graphics library +
-#include <Adafruit_ST7735.h> // Hardware-specific library +
-#include <SPI.h> +
- +
-/* +
- * Pin assignments: +
- * RST: 8 +
- * CE/CS/SCE: 10 +
- * DC/"D/C"/A0:+
- * DIN/DN/MOSI/DATA: 11 (Arduino HW standard) +
- * CLK/SCLK/SCK: 13  (Arduino HW standard) +
- * VCC: 3.3V +
- * LIGHT/LED: ground through 1 ohm resistor (yields about 20mA) +
- * GND: ground +
- */ +
- +
-const unsigned int CLOCK_PIN = 13, +
-                   DATA_PIN = 11, +
-                   TFT_CS = 10, +
-                   TFT_DC = 9, +
-                   TFT_RST = 8; +
- +
-const unsigned int TOP_MARGIN = 32;    // number of pixels you need to shift for 128x128 screen +
- +
-// Use hardware SPI. +
-Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST); // Use hardware SPI +
-unsigned int counter = 80; +
- +
-void setup(void) { +
-  // mfk note: neither initializer below works for the 128x128 +
-  tft.initR(INITR_BLACKTAB);   // 1.8"initialize a ST7735S chip, black tab +
-  // tft.initR(INITR_144GREENTAB);   // 1.44", initialize a ST7735S chip, black tab +
- +
-  tft.fillScreen(ST7735_BLACK);  // clear the screen +
-  tft.setTextWrap(false); +
- +
-  tft.setCursor(0, TOP_MARGIN); +
-  tft.setTextSize(1); +
-  tft.setTextColor(ST7735_WHITE); +
-  tft.setTextWrap(true); +
-  tft.print("Adafruit ST7735"); +
-+
- +
-void loop() { +
-  tft.setTextSize(7); +
- +
-  // draw over what you wrote last time +
-  tft.setCursor(0, TOP_MARGIN + 40); +
-  tft.setTextColor(ST7735_BLACK); +
-  tft.print(counter);     +
- +
-  // update and draw something new +
-  counter++; +
-  tft.setCursor(0, TOP_MARGIN + 40); +
-  tft.setTextColor(ST7735_WHITE); +
-  tft.print(counter); +
-   +
-  // inherent frame rate of this loop is about 15 fps w/o added delay (8 MHz processor). +
-  delay(500); +
-+
- +
-</file>+
  
 === Fancy large font === === Fancy large font ===
Line 143: Line 69:
 FIXME video FIXME video
  
-<file c++ display_st7735_1.44_adafruit_st7735_fonts.ino+[[display_st7735_1.44_adafruit_st7735_fonts.ino | source code]]
-/* +
- * display_st7735_1.44_adafruit_st7735_fonts.ino +
-   +
- * Test screen update speed with large fancy font on  +
- * a 128x128 TFT screen that uses the ST7735 chip. +
- *  +
- * Consumes 53% of program storage space and +
- * 6% of dynamic memory on a Pro Mini. +
- *  +
- * Mithat Konar +
- */ +
- +
-#include <Adafruit_GFX.h>    // Core graphics library +
-#include <Adafruit_ST7735.h> // Hardware-specific library +
-#include <SPI.h> +
-#include <Fonts/FreeSans24pt7b.h> +
- +
-/* +
- * Pin assignments: +
- * RST: 8 +
- * CE/CS/SCE: 10 +
- * DC/"D/C"/A0:+
- * DIN/DN/MOSI/DATA: 11 (Arduino HW standard) +
- * CLK/SCLK/SCK: 13  (Arduino HW standard) +
- * VCC: 3.3V +
- * LIGHT/LED: ground through 1 ohm resistor (yields about 20mA) +
- * GND: ground +
- */ +
- +
-const unsigned int CLOCK_PIN = 13, +
-                   DATA_PIN = 11, +
-                   TFT_CS = 10, +
-                   TFT_DC = 9, +
-                   TFT_RST = 8; +
- +
-const unsigned int TOP_MARGIN = 32;    // number of pixels you need to shift for 128x128 screen +
- +
-// Use hardware SPI. +
-Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST); // Use hardware SPI +
-unsigned int counter = 80; +
- +
-void setup(void) { +
-  // mfk note: neither initializer below works for the 128x128 +
-  tft.initR(INITR_BLACKTAB);   // 1.8"initialize a ST7735S chip, black tab +
-  // tft.initR(INITR_144GREENTAB);   // 1.44", initialize a ST7735S chip, black tab +
- +
-  tft.fillScreen(ST7735_BLACK);  // clear the screen +
-  tft.setTextWrap(false); +
- +
-  tft.setCursor(0, TOP_MARGIN); +
-  tft.setTextSize(1); +
-  tft.setTextColor(ST7735_WHITE); +
-  tft.setTextWrap(true); +
-  tft.print("Adafruit ST7735 fonts"); +
- +
-  tft.setFont(&FreeSans24pt7b); +
-+
- +
-void loop() { +
-  // draw over what you wrote last time +
-  tft.setCursor(0, TOP_MARGIN + 80); +
-  tft.setTextColor(ST7735_BLACK); +
-  tft.print(counter);     +
- +
-  // update and draw something new +
-  counter++; +
-  tft.setCursor(0, TOP_MARGIN + 80); +
-  tft.setTextColor(ST7735_WHITE); +
-  tft.print(counter); +
-   +
-  // inherent frame rate of this loop is about 2.5 fps w/o added delay (8 MHz processor). +
-  delay(500); +
-}+
  
-</file> 
arduino/displays_for_classic_arduinos/1.8_and_1.44_tft_displays_and_classic_arduinos.txt · Last modified: 2018/01/31 04:55 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki