| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #include <SPI.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_PCD8544.h>
- #define Adafruit_PCD8544_LED 9 //NIEB
- #define Adafruit_PCD8544_CLK 13 //NIEB
- #define Adafruit_PCD8544_DIN 11 //DN MOSI? //ZIEL
- #define Adafruit_PCD8544_DC 7 //ZOLT
- #define Adafruit_PCD8544_CS 10 //SCE CZERWON
- #define Adafruit_PCD8544_RST 8 //POMARANCZ
- // Declare LCD object for software SPI
- // Adafruit_PCD8544(CLK,DIN,D/C,CE,RST);
- // Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, int8_t CS, int8_t RST);
- Adafruit_PCD8544 display = Adafruit_PCD8544(Adafruit_PCD8544_CLK, Adafruit_PCD8544_DIN, Adafruit_PCD8544_DC, Adafruit_PCD8544_CS, Adafruit_PCD8544_RST);
- /*
- *
- * Pinout Table :Pinout Table :
- Pin Number | Pin Label | Pin Function |Input/Output
- 1 | VCC | Positive power supply | Input
- 2 | GND | Ground | Input
- 3 | SCE | Chip select | Input //dp10
- 4 | RST | Reset | Input //dp8
- 5 | D/C | Mode select | Input //dp7
- 6 | DN(MOSI) | Serial data in | Input //dp11
- 7 | SCLK | Serial clock | Input //dp13
- 8 | LED | LED backlight supply | Input //dp9
- * */
- int rotatetext = 1;
- void setup() {
- Serial.begin(9600);
- //Initialize Display
- display.begin();
- // you can change the contrast around to adapt the display for the best viewing!
- display.setContrast(57);
- // Clear the buffer.
- display.clearDisplay();
- // Display Text
- display.setTextSize(1);
- display.setTextColor(BLACK);
- display.setCursor(0,0);
- display.println("Hello world!");
- display.display();
- delay(2000);
- display.clearDisplay();
- // Display Inverted Text
- display.setTextColor(WHITE, BLACK); // 'inverted' text
- display.setCursor(0,0);
- display.println("Hello world!");
- display.display();
- delay(2000);
- display.clearDisplay();
- //digitalWrite();
- analogWrite(Adafruit_PCD8544_LED,125);
- // Scaling Font Size
- display.setTextColor(BLACK);
- display.setCursor(0,0);
- display.setTextSize(2);
- display.println("Hello!");
- display.display();
- delay(2000);
- display.clearDisplay();
- // Display Numbers
- display.setTextSize(1);
- display.setCursor(0,0);
- display.println(123456789);
- display.display();
- delay(2000);
- display.clearDisplay();
- // Specifying Base For Numbers
- display.setCursor(0,0);
- display.print("0x"); display.print(0xFF, HEX);
- display.print("(HEX) = ");
- display.print(0xFF, DEC);
- display.println("(DEC)");
- display.display();
- delay(2000);
- display.clearDisplay();
- // Display ASCII Characters
- display.setCursor(0,0);
- display.setTextSize(2);
- display.write(3);
- display.display();
- delay(2000);
- display.clearDisplay();
- // Text Rotation
- while(1)
- {
- display.clearDisplay();
- display.setRotation(rotatetext); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further.
- display.setTextSize(1);
- display.setTextColor(BLACK);
- display.setCursor(0,0);
- display.println("Text Rotation");
- display.display();
- delay(1000);
- display.clearDisplay();
- rotatetext++;
- }
- }
- void loop() {}
|