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.

writeCharacters.ino 1.6KB

3 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. HCMS Display
  3. Language: Arduino/Wiring
  4. Writes characters on an Avago HCMS-297x display
  5. String library based on the Wiring String library:
  6. http://wiring.org.co/learning/reference/String.html
  7. created 12 Jun. 2008
  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 bytes needed to pad the string
  20. // create am instance of the LED display:
  21. LedDisplay myDisplay = LedDisplay(dataPin, registerSelect, clockPin,
  22. enable, reset, displayLength);
  23. int brightness = 15; // screen brightness
  24. char myString[] = {
  25. 'p','r','i','n','t','i','n','g'};
  26. void setup() {
  27. Serial.begin(9600);
  28. // initialize the display library:
  29. myDisplay.begin();
  30. myDisplay.setString("Printing");
  31. myDisplay.home();
  32. myDisplay.setBrightness(brightness);
  33. }
  34. void loop() {
  35. for (int thisPosition = 0; thisPosition < 8; thisPosition++) {
  36. for (int thisChar = ' '; thisChar < 'z'; thisChar++) {
  37. myDisplay.write(thisChar);
  38. myDisplay.setCursor(thisPosition);
  39. delay(3);
  40. }
  41. myDisplay.write(myString[thisPosition]);
  42. delay(10);
  43. }
  44. delay(500);
  45. myDisplay.clear();
  46. myDisplay.home();
  47. }