Advertisement
pm2d

Arduino lcd pinus

Mar 12th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.05 KB | None | 0 0
  1. // include the library code:
  2. #include <LiquidCrystal.h>
  3.  
  4. // initialize the library by associating any needed LCD interface pin
  5. // with the arduino pin number it is connected to
  6. LiquidCrystal lcd(7, 6,  5, 4, 3, 2);
  7.  
  8. // make some custom characters:
  9. byte cock[8] = {
  10.   0b00100,
  11.   0b01110,
  12.   0b01010,
  13.   0b01010,
  14.   0b01010,
  15.   0b10001,
  16.   0b10101,
  17.   0b01010
  18. };
  19.  
  20. byte eggs[8] = {
  21.   0b01110,
  22.   0b10001,
  23.   0b10000,
  24.   0b01000,
  25.   0b10000,
  26.   0b10001,
  27.   0b01110,
  28.   0b00000
  29. };
  30.  
  31. byte dickhead[8] = {
  32.   0b00000,
  33.   0b11110,
  34.   0b00001,
  35.   0b00011,
  36.   0b00001,
  37.   0b11110,
  38.   0b00000,
  39.   0b00000
  40. };
  41.  
  42. // pinus
  43. void drawpinus(int pinus_length)
  44. {
  45.   lcd.write(1);
  46.   for (int i = 0; i< pinus_length; i++)
  47.   {
  48.     lcd.print("=");
  49.   }
  50.   lcd.write(2);
  51.   lcd.print(" ");
  52. }
  53.  
  54. void setup() {
  55.   // set up the LCD's number of columns and rows:
  56.   lcd.begin(16, 2);
  57.   // custom chars
  58.   lcd.createChar(0, cock);
  59.   lcd.createChar(1, eggs);
  60.   lcd.createChar(2, dickhead);
  61. }
  62.  
  63. void loop() {
  64.   // page 1 (it works)
  65.   lcd.setCursor(0, 0);
  66.   lcd.print("E6ATb! PA6OTAET!");
  67.   lcd.setCursor(0, 1);
  68.   lcd.write((byte)0);
  69.   lcd.write((byte)0);
  70.   lcd.write((byte)0);
  71.   lcd.print(" Xyu!Xyu! ");
  72.   lcd.write((byte)0);
  73.   lcd.write((byte)0);
  74.   lcd.write((byte)0);
  75.   delay(2000);
  76.   // page 2 (o,rly)
  77.   lcd.setCursor(0, 0);
  78.   lcd.print("***  OXyETb  ***");
  79.   lcd.setCursor(4, 1);
  80.   drawpinus(6);
  81.   delay(2000);
  82.   // page 3 (the pinuses)
  83.   lcd.setCursor(0, 0);
  84.   lcd.print("   ");
  85.   drawpinus(3);
  86.   drawpinus(3);
  87.   drawpinus(3);
  88.   drawpinus(3);
  89.   drawpinus(3);
  90.   drawpinus(3);
  91.   lcd.setCursor(0, 1);
  92.   drawpinus(3);
  93.   drawpinus(3);
  94.   drawpinus(3);
  95.   drawpinus(3);
  96.   drawpinus(3);
  97.   drawpinus(3);
  98.   delay(1000);
  99.   // pinuses fly right
  100.   for (int i = 0; i < 80; i++)
  101.   {
  102.     lcd.scrollDisplayRight();
  103.     delay(250);
  104.   }
  105.   delay(2000);
  106.   // page 4 (uptime)
  107.   lcd.setCursor(0, 0);
  108.   lcd.print(millis() / 1000);
  109.   lcd.print(" seconds      ");
  110.   lcd.setCursor(0, 1);
  111.   lcd.print(millis() / 60000);
  112.   lcd.print(" minutes       ");
  113.   delay(3000);
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement