NOKIA.ino 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #include <SPI.h>
  2. #include <Adafruit_GFX.h>
  3. #include <Adafruit_PCD8544.h>
  4. #define Adafruit_PCD8544_LED 9 //NIEB
  5. #define Adafruit_PCD8544_CLK 13 //NIEB
  6. #define Adafruit_PCD8544_DIN 11 //DN MOSI? //ZIEL
  7. #define Adafruit_PCD8544_DC 7 //ZOLT
  8. #define Adafruit_PCD8544_CS 10 //SCE CZERWON
  9. #define Adafruit_PCD8544_RST 8 //POMARANCZ
  10. // Declare LCD object for software SPI
  11. // Adafruit_PCD8544(CLK,DIN,D/C,CE,RST);
  12. // Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, int8_t CS, int8_t RST);
  13. Adafruit_PCD8544 display = Adafruit_PCD8544(Adafruit_PCD8544_CLK, Adafruit_PCD8544_DIN, Adafruit_PCD8544_DC, Adafruit_PCD8544_CS, Adafruit_PCD8544_RST);
  14. /*
  15. *
  16. * Pinout Table :Pinout Table :
  17. Pin Number | Pin Label | Pin Function |Input/Output
  18. 1 | VCC | Positive power supply | Input
  19. 2 | GND | Ground | Input
  20. 3 | SCE | Chip select | Input //dp10
  21. 4 | RST | Reset | Input //dp8
  22. 5 | D/C | Mode select | Input //dp7
  23. 6 | DN(MOSI) | Serial data in | Input //dp11
  24. 7 | SCLK | Serial clock | Input //dp13
  25. 8 | LED | LED backlight supply | Input //dp9
  26. * */
  27. int rotatetext = 1;
  28. void setup() {
  29. Serial.begin(9600);
  30. //Initialize Display
  31. display.begin();
  32. // you can change the contrast around to adapt the display for the best viewing!
  33. display.setContrast(57);
  34. // Clear the buffer.
  35. display.clearDisplay();
  36. // Display Text
  37. display.setTextSize(1);
  38. display.setTextColor(BLACK);
  39. display.setCursor(0,0);
  40. display.println("Hello world!");
  41. display.display();
  42. delay(2000);
  43. display.clearDisplay();
  44. // Display Inverted Text
  45. display.setTextColor(WHITE, BLACK); // 'inverted' text
  46. display.setCursor(0,0);
  47. display.println("Hello world!");
  48. display.display();
  49. delay(2000);
  50. display.clearDisplay();
  51. //digitalWrite();
  52. analogWrite(Adafruit_PCD8544_LED,125);
  53. // Scaling Font Size
  54. display.setTextColor(BLACK);
  55. display.setCursor(0,0);
  56. display.setTextSize(2);
  57. display.println("Hello!");
  58. display.display();
  59. delay(2000);
  60. display.clearDisplay();
  61. // Display Numbers
  62. display.setTextSize(1);
  63. display.setCursor(0,0);
  64. display.println(123456789);
  65. display.display();
  66. delay(2000);
  67. display.clearDisplay();
  68. // Specifying Base For Numbers
  69. display.setCursor(0,0);
  70. display.print("0x"); display.print(0xFF, HEX);
  71. display.print("(HEX) = ");
  72. display.print(0xFF, DEC);
  73. display.println("(DEC)");
  74. display.display();
  75. delay(2000);
  76. display.clearDisplay();
  77. // Display ASCII Characters
  78. display.setCursor(0,0);
  79. display.setTextSize(2);
  80. display.write(3);
  81. display.display();
  82. delay(2000);
  83. display.clearDisplay();
  84. // Text Rotation
  85. while(1)
  86. {
  87. display.clearDisplay();
  88. display.setRotation(rotatetext); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further.
  89. display.setTextSize(1);
  90. display.setTextColor(BLACK);
  91. display.setCursor(0,0);
  92. display.println("Text Rotation");
  93. display.display();
  94. delay(1000);
  95. display.clearDisplay();
  96. rotatetext++;
  97. }
  98. }
  99. void loop() {}