PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

scrollTest.ino 2.2KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /***************************************************
  2. This is our GFX example for the Adafruit ST7735 Breakout and Shield
  3. ----> http://www.adafruit.com/products/1651
  4. Check out the links above for our tutorials and wiring diagrams
  5. These displays use SPI to communicate, 4 or 5 pins are required to
  6. interface (RST is optional)
  7. Adafruit invests time and resources providing this open source code,
  8. please support Adafruit and open-source hardware by purchasing
  9. products from Adafruit!
  10. Written by Limor Fried/Ladyada for Adafruit Industries.
  11. MIT license, all text above must be included in any redistribution
  12. ****************************************************/
  13. #include <ST7735_t3.h> // Hardware-specific library
  14. #include <ST7789_t3.h> // Hardware-specific library
  15. #include <SPI.h>
  16. #include <st7735_t3_font_ComicSansMS.h>
  17. #define TFT_MISO 12
  18. #define TFT_MOSI 11 //a12
  19. #define TFT_SCK 13 //a13
  20. #define TFT_DC 9
  21. #define TFT_CS 10
  22. #define TFT_RST 8
  23. // Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
  24. ST7789_t3 tft = ST7789_t3(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCK, TFT_RST);
  25. // If using the breakout, change pins as desired
  26. //Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
  27. void setup() {
  28. Serial.begin(9600);
  29. tft.init(240, 320); // Init ST7789 320x240
  30. tft.setRotation(3);
  31. tft.useFrameBuffer(true);
  32. tft.fillScreen(ST7735_BLACK);
  33. while (!Serial) ;
  34. tft.setTextColor(ST7735_WHITE); tft.setTextSize(1);
  35. tft.enableScroll();
  36. tft.setScrollTextArea(0,0,120,240);
  37. tft.setScrollBackgroundColor(ST7735_GREEN);
  38. tft.setCursor(180, 100);
  39. tft.setFont(ComicSansMS_12);
  40. tft.print("Fixed text");
  41. tft.setCursor(0, 0);
  42. tft.setTextColor(ST7735_BLACK);
  43. for(int i=0;i<20;i++){
  44. tft.print(" this is line ");
  45. tft.println(i);
  46. tft.updateScreen();
  47. delay(100);
  48. }
  49. tft.fillScreen(ST7735_BLACK);
  50. tft.setScrollTextArea(40,50,120,120);
  51. tft.setScrollBackgroundColor(ST7735_GREEN);
  52. tft.setFont(ComicSansMS_10);
  53. tft.setTextSize(1);
  54. tft.setCursor(40, 50);
  55. for(int i=0;i<20;i++){
  56. tft.print(" this is line ");
  57. tft.println(i);
  58. tft.updateScreen();
  59. delay(500);
  60. }
  61. }
  62. void loop(void) {
  63. }