PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

47 行
1.3KB

  1. #include <Arduino.h>
  2. #include <SPI.h>
  3. #include <ssd1351.h>
  4. // This example is used to illustrate the different color modes. Select a different mode to see
  5. // different amounts of colour banding.
  6. typedef ssd1351::IndexedColor Color;
  7. // typedef ssd1351::LowColor Color;
  8. // typedef ssd1351::HighColor Color;
  9. // Choose display buffering - NoBuffer or SingleBuffer currently supported
  10. // auto display = ssd1351::SSD1351<Color, ssd1351::NoBuffer, 128, 96>();
  11. auto display = ssd1351::SSD1351<Color, ssd1351::SingleBuffer, 128, 96>();
  12. void setup() {
  13. Serial.begin(9600);
  14. Serial.println("Booting...");
  15. display.begin();
  16. Serial.println("Display set up.");
  17. }
  18. void loop() {
  19. for(int i=0; i<128; i++) {
  20. display.drawLine(i, 0, i, 15, ssd1351::RGB(i, 0, 0));
  21. }
  22. for(int i=128; i<256; i++) {
  23. display.drawLine(256 - i, 16, 256 - i, 31, ssd1351::RGB(i, 0, 0));
  24. }
  25. for(int i=0; i<128; i++) {
  26. display.drawLine(i, 32, i, 47, ssd1351::RGB(0, i, 0));
  27. }
  28. for(int i=128; i<256; i++) {
  29. display.drawLine(256 - i, 48, 256 - i, 63, ssd1351::RGB(0, i, 0));
  30. }
  31. for(int i=0; i<128; i++) {
  32. display.drawLine(i, 64, i, 79, ssd1351::RGB(0, 0, i));
  33. }
  34. for(int i=128; i<256; i++) {
  35. display.drawLine(256 - i, 80, 256 - i, 95, ssd1351::RGB(0, 0, i));
  36. }
  37. display.updateScreen();
  38. delay(2000);
  39. }