PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

58 lines
1.7KB

  1. /*
  2. HCMS Display
  3. Language: Arduino/Wiring
  4. Displays a string on three Avago HCMS-297x displays.
  5. Scrolls the string left and right.
  6. created 12 Jun. 2008
  7. modified 11 March 2010
  8. by Tom Igoe
  9. */
  10. #include <LedDisplay.h>
  11. // Define pins for the LED display.
  12. // You can change these, just re-wire your board:
  13. #define dataPin 6 // connects to the display's data in
  14. #define registerSelect 7 // the display's register select pin
  15. #define clockPin 8 // the display's clock pin
  16. #define enable 9 // the display's chip enable pin
  17. #define reset 10 // the display's reset pin
  18. #define displayLength 24 // total number of characters in all three displays
  19. // create am instance of the LED display:
  20. LedDisplay myDisplay = LedDisplay(dataPin, registerSelect, clockPin,
  21. enable, reset, displayLength);
  22. int brightness = 15; // screen brightness
  23. int myDirection = 1; // direction of scrolling. -1 = left, 1 = right.
  24. void setup() {
  25. Serial.begin(9600);
  26. // initialize the display library:
  27. myDisplay.begin();
  28. myDisplay.clear();
  29. myDisplay.setString("Aardvarks mark the park after dark.");
  30. myDisplay.setBrightness(brightness);
  31. delay(100);
  32. }
  33. void loop() {
  34. // when the string scrolls off the display, reverse scroll direction.
  35. // On the right, it scrolls off at position 8.
  36. // on the left, it scrolls off when the cursor is less than -(the length of the string):
  37. if ((myDisplay.getCursor() > displayLength) ||
  38. (myDisplay.getCursor() <= -(myDisplay.stringLength()))) {
  39. myDirection = -myDirection;
  40. delay(1000);
  41. }
  42. // scroll:
  43. myDisplay.scroll(myDirection);
  44. delay(100);
  45. }