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.

easyScroll.ino 2.1KB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. Rudimentary scroll!
  3. */
  4. #include <SPI.h>
  5. #include <Adafruit_GFX.h>
  6. #include <TFT_ILI9163C.h>
  7. // Color definitions
  8. #define BLACK 0x0000
  9. #define BLUE 0x001F
  10. #define RED 0xF800
  11. #define GREEN 0x07E0
  12. #define CYAN 0x07FF
  13. #define MAGENTA 0xF81F
  14. #define YELLOW 0xFFE0
  15. #define WHITE 0xFFFF
  16. /*
  17. Teensy3.x and Arduino's
  18. You are using 4 wire SPI here, so:
  19. MOSI: 11//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
  20. MISO: 12//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
  21. SCK: 13//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
  22. the rest of pin below:
  23. */
  24. #define __CS 10
  25. #define __DC 9
  26. /*
  27. Teensy 3.x can use: 2,6,9,10,15,20,21,22,23
  28. Arduino's 8 bit: any
  29. DUE: check arduino site
  30. If you do not use reset, tie it to +3V3
  31. */
  32. TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC);
  33. void setup() {
  34. tft.begin();
  35. tft.setRotation(0);
  36. tft.setCursor(0, 0);
  37. tft.setTextColor(WHITE);
  38. tft.setTextSize(1);
  39. tft.println("Hello World!");
  40. tft.setTextColor(YELLOW);
  41. tft.setTextSize(2);
  42. tft.println(1234.56);
  43. tft.setTextColor(RED);
  44. tft.setTextSize(3);
  45. tft.println(0xDEAD, HEX);
  46. tft.println();
  47. tft.setTextColor(GREEN);
  48. tft.setTextSize(4);
  49. tft.println("Hello");
  50. tft.setTextSize(2);
  51. tft.println("I implore thee,");
  52. tft.setTextSize(1);
  53. tft.println("my foonting turlingdromes.");
  54. tft.println("And hooptiously drangle me");
  55. tft.println("with crinkly bindlewurdles,");
  56. tft.println("Or I will rend thee");
  57. tft.println("in the gobberwarts");
  58. tft.println("with my blurglecruncheon,");
  59. tft.println("see if I don't!");
  60. tft.defineScrollArea(23,50);
  61. //try load again with this commented out!
  62. }
  63. int t = 0;
  64. void loop(void) {
  65. tft.scroll(t);
  66. if (t > 160) {
  67. t = 0;
  68. }
  69. else {
  70. t++;
  71. }
  72. delay(10);
  73. }
  74. void testFilledRects() {
  75. int n, i, i2,
  76. cx = (tft.width() / 2),
  77. cy = (tft.height() / 2);
  78. n = min(tft.width(), tft.height());
  79. for(i=n; i>0; i-=6) {
  80. i2 = i / 2;
  81. tft.fillRect(cx-i2, cy-i2, i, i, random(0x0000,0xFFFF));
  82. tft.drawRect(cx-i2, cy-i2, i, i, random(0x0000,0xFFFF));
  83. }
  84. }