PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20

fade.ino 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. HCMS29xx Display
  3. Language: Arduino/Wiring
  4. Displays a string on an Avago HCMS-297x display
  5. and fades it up and down.
  6. http://wiring.org.co/learning/reference/String.html
  7. created 10 Apr 2009
  8. modified 11 March 2010
  9. by Tom Igoe
  10. */
  11. #include <LedDisplay.h>
  12. // Define pins for the LED display.
  13. // You can change these, just re-wire your board:
  14. #define dataPin 6 // connects to the display's data in
  15. #define registerSelect 7 // the display's register select pin
  16. #define clockPin 8 // the display's clock pin
  17. #define enable 9 // the display's chip enable pin
  18. #define reset 10 // the display's reset pin
  19. #define displayLength 8 // number of characters in the display
  20. // create am instance of the LED display library:
  21. LedDisplay myDisplay = LedDisplay(dataPin, registerSelect, clockPin,
  22. enable, reset, displayLength);
  23. int brightness = 15; // screen brightness
  24. void setup() {
  25. Serial.begin(9600);
  26. // initialize the display library:
  27. myDisplay.begin();
  28. }
  29. void loop() {
  30. for (int brightness = 0; brightness < 16; brightness++) {
  31. // set the display string brightness:
  32. myDisplay.setBrightness(brightness);
  33. // set the cursor to position 1:
  34. myDisplay.setCursor(1);
  35. // print to the display:
  36. myDisplay.print("Fading");
  37. delay(50);
  38. }
  39. delay(100);
  40. for (int brightness = 15; brightness >= 0; brightness--) {
  41. // set the display string brightness:
  42. myDisplay.setBrightness(brightness);
  43. // set the cursor to position 1:
  44. myDisplay.setCursor(1);
  45. // print to the display:
  46. myDisplay.print("Fading");
  47. delay(50);
  48. }
  49. delay(300);
  50. }