a5768549

LCD_I2C_custom_char_test

Sep 18th, 2020 (edited)
1,033
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. uint8_t shang[8]= {0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x1F,};//上
  5. uint8_t wu[8]= {0x08,0x08,0x0E,0x14,0x04,0x1F,0x04,0x04,};//午
  6. uint8_t xia[8] = {0x1F,0x04,0x04,0x06,0x05,0x04,0x04,0x04,};//下
  7. uint8_t yu[8] = {0x1F,0x04,0x1F,0x15,0x1F,0x15,0x1F,0x15,};//雨
  8. uint8_t le[8] = {0x1F,0x01,0x02,0x04,0x04,0x04,0x04,0x0C,};//了
  9.  
  10. LiquidCrystal_I2C lcd(0x27, 16, 2);
  11.  
  12. void setup()
  13. {
  14.   lcd.begin();
  15.   lcd.backlight();
  16.  
  17.   lcd.createChar(0, shang);
  18.   lcd.createChar(1, wu);
  19.   lcd.createChar(2, xia);
  20.   lcd.createChar(3, yu);
  21.   lcd.createChar(4, le);
  22.  
  23.   lcd.setCursor(0,0);
  24.   lcd.write(0);
  25.   lcd.write(1);
  26.   lcd.write(2);
  27.   lcd.write(3);
  28.   lcd.write(4);
  29. }
  30.  
  31. void loop()
  32. {
  33.     // Do nothing here...
  34. }
  35.  
RAW Paste Data