Guest User

lcd_test.ino

a guest
Nov 11th, 2014
5,708
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Adafruit_GFX.h>
  2. #include <Adafruit_PCD8544.h>
  3.  
  4. // pin 7 - Serial clock out (SCLK)
  5. // pin 6 - Serial data out (DIN)
  6. // pin 5 - Data/Command select (D/C)
  7. // pin 4 - LCD chip select (CS)
  8. // pin 3 - LCD reset (RST)
  9. Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
  10.  
  11. static unsigned char PROGMEM sword38x38[] =
  12. {
  13.  0xFF, 0xF0, 0x00, 0x00, 0x00,
  14.  0xFF, 0xF0, 0x00, 0x00, 0x00,
  15.  0xC0, 0x0C, 0x00, 0x00, 0x00,
  16.  0xC0, 0x0C, 0x00, 0x00, 0x00,
  17.  0xC0, 0x03, 0x00, 0x00, 0x00,
  18.  0xC0, 0x03, 0x00, 0x00, 0x00,
  19.  0xC0, 0x03, 0x00, 0x00, 0x00,
  20.  0xC0, 0x03, 0x00, 0x00, 0x00,
  21.  0xC0, 0x00, 0xC0, 0x00, 0x00,
  22.  0xC0, 0x00, 0xC0, 0x00, 0x00,
  23.  0xC0, 0x00, 0x30, 0x00, 0x00,
  24.  0xC0, 0x00, 0x30, 0x00, 0x00,
  25.  0x30, 0x00, 0x30, 0x00, 0x00,
  26.  0x30, 0x00, 0x30, 0x00, 0x00,
  27.  0x0F, 0x00, 0x0C, 0x03, 0x00,
  28.  0x0F, 0x00, 0x0C, 0x03, 0x00,
  29.  0x00, 0xC0, 0x03, 0x0C, 0xC0,
  30.  0x00, 0xC0, 0x03, 0x0C, 0xC0,
  31.  0x00, 0x3C, 0x03, 0x0C, 0xC0,
  32.  0x00, 0x3C, 0x03, 0x0C, 0xC0,
  33.  0x00, 0x03, 0x00, 0xF3, 0x00,
  34.  0x00, 0x03, 0x00, 0xF3, 0x00,
  35.  0x00, 0x00, 0xF0, 0x33, 0x00,
  36.  0x00, 0x00, 0xF0, 0x33, 0x00,
  37.  0x00, 0x00, 0x0C, 0xCC, 0x00,
  38.  0x00, 0x00, 0x0C, 0xCC, 0x00,
  39.  0x00, 0x00, 0x0F, 0x33, 0x00,
  40.  0x00, 0x00, 0x0F, 0x33, 0x00,
  41.  0x00, 0x00, 0xF0, 0xC0, 0xC0,
  42.  0x00, 0x00, 0xF0, 0xC0, 0xC0,
  43.  0x00, 0x03, 0x0F, 0x30, 0xF0,
  44.  0x00, 0x03, 0x0F, 0x30, 0xF0,
  45.  0x00, 0x00, 0xF0, 0x0F, 0x0C,
  46.  0x00, 0x00, 0xF0, 0x0F, 0x0C,
  47.  0x00, 0x00, 0x00, 0x03, 0x0C,
  48.  0x00, 0x00, 0x00, 0x03, 0x0C,
  49.  0x00, 0x00, 0x00, 0x00, 0xF0,
  50.  0x00, 0x00, 0x00, 0x00, 0xF0
  51. };
  52.  
  53. void setup() {
  54.   display.begin();
  55.   display.setContrast(60);
  56.   display.setTextSize(2);
  57. }
  58.  
  59.  
  60. void loop() {
  61.   display.clearDisplay();
  62.   display.drawBitmap(23, 5, sword38x38, 38, 38, BLACK);
  63.   display.display();
  64.   delay(1000);
  65.   display.clearDisplay();
  66.   display.print(" Привет");
  67.   display.println("  Habr");
  68.   display.println(" \xab \xa4 \xbb");
  69.   display.display();
  70.   delay(1000);
  71. }
RAW Paste Data