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.

преди 3 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include <LiquidCrystalFast.h>
  2. // initialize the library with the numbers of the interface pins
  3. LiquidCrystalFast lcd(12, 10, 11, 5, 4, 3, 2);
  4. // LCD pins: RS RW EN D4 D5 D6 D7
  5. // to see the speed of the original library, comment out the
  6. // LiquidCrystalFast line above, and uncomment these 2 lines.
  7. //#include <LiquidCrystal.h>
  8. //LiquidCrystal lcd(12, 10, 11, 5, 4, 3, 2);
  9. const int nRows = 4; //number of rows on LCD
  10. const int nColumns = 16; //number of columns
  11. const int length = nRows * nColumns;
  12. char text[length+1];
  13. char blanks[length+1];
  14. void setup(void) {
  15. lcd.begin(nColumns,nRows);
  16. lcd.setCursor(0,0);
  17. char c = 'A';
  18. for (int i=0; i<length; i++) {
  19. text[i] = c++;
  20. blanks[i] = ' ';
  21. if (c > 'Z') c = 'A';
  22. }
  23. text[length] = 0;
  24. blanks[length] = 0;
  25. unsigned long startTime=millis();
  26. byte repetitions = 20;
  27. while (repetitions--) {
  28. lcd.setCursor(0,0); // fill every screen pixel with text
  29. lcd.print(text);
  30. lcd.setCursor(0,0); // then fill every pixel with blanks and repeat
  31. lcd.print(blanks);
  32. }
  33. unsigned long endTime = millis();
  34. lcd.clear();
  35. lcd.setCursor(0,0);
  36. lcd.print("Benchmark ");
  37. lcd.print(nColumns, DEC);
  38. lcd.write('x');
  39. lcd.print(nRows, DEC);
  40. lcd.setCursor(0,1);
  41. lcd.print(endTime - startTime);
  42. lcd.print(" millisecs.");
  43. }
  44. void loop() {
  45. }