Advertisement
Guest User

Вальо вица

a guest
Apr 1st, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. LiquidCrystal lcd(10, 9, 5, 4, 3, 2);
  4.  
  5. int pingPin = 11;
  6. int echoPin= 12;
  7.  
  8. byte smiley[8] = {
  9. B00000,
  10. B10001,
  11. B00000,
  12. B01110,
  13. B10001,
  14. B01110,
  15. B00000,
  16. };
  17.  
  18. byte dick[8] {
  19. B01110,
  20. B10101,
  21. B01010,
  22. B01010,
  23. B01010,
  24. B11111,
  25. B10101,
  26. B11111,
  27. };
  28.  
  29. byte penta[8] {
  30. B00100,
  31. B01010,
  32. B11111,
  33. B10001,
  34. B01110,
  35. B10101,
  36. B11011,
  37. };
  38.  
  39. byte TMNT[8] {
  40. B00000,
  41. B00011,
  42. B00100,
  43. B11111,
  44. B01110,
  45. B01110,
  46. B10001
  47. };
  48.  
  49.  
  50. byte db1[8]{
  51. B00000,
  52. B01111,
  53. B11000,
  54. B10010,
  55. B10000,
  56. B10000,
  57. B10010,
  58. B11111
  59. };
  60.  
  61. byte db2[8]{
  62. B00111,
  63. B11010,
  64. B01110,
  65. B00000,
  66. B10000,
  67. B10000,
  68. B10000,
  69. B11111
  70. };
  71.  
  72. byte db3[8] {
  73. B11000,
  74. B01000,
  75. B00111,
  76. B00100,
  77. B00100,
  78. B11111,
  79. B00100,
  80. B11000
  81. };
  82.  
  83. byte db4[8] {
  84. B00000,
  85. B00000,
  86. B10000,
  87. B10000,
  88. B00000,
  89. B10000,
  90. B10000,
  91. B00000,
  92. };
  93.  
  94. void setup() {
  95. // set up the LCD's number of columns and rows:
  96. lcd.begin(16, 2);
  97. // Print a message to the LCD.
  98. lcd.print("hello, world!");
  99. }
  100.  
  101. void loop() {
  102. long duration, inches, cm;
  103. int i;
  104. lcd.createChar(0, penta);
  105. lcd.begin(16, 2);
  106. lcd.write(byte(0));
  107. lcd.createChar(1, dick);
  108. lcd.setCursor(0,2);
  109. lcd.write(byte(1));
  110. lcd.createChar(2, TMNT);
  111. lcd.setCursor(1,0);
  112. lcd.write(byte(2));
  113.  
  114. lcd.createChar(3, db1);
  115. lcd.createChar(4, db2);
  116. lcd.createChar(5, db3);
  117. lcd.createChar(6, db4);
  118. lcd.setCursor(3,0);
  119. lcd.write(byte(3));
  120. lcd.setCursor(4,0);
  121. lcd.write(byte(4));
  122. lcd.setCursor(5,0);
  123. lcd.write(byte(5));
  124. lcd.setCursor(6,0);
  125. lcd.write(byte(6));
  126.  
  127.  
  128. // pinMode(pingPin, OUTPUT);
  129. // digitalWrite(pingPin, LOW);
  130. // delayMicroseconds(2);
  131. // digitalWrite(pingPin, HIGH);
  132. // delayMicroseconds(5);
  133. // digitalWrite(pingPin, LOW);
  134. //
  135. // pinMode(pingPin, INPUT);
  136. // duration = pulseIn(pingPin, HIGH);
  137. //
  138. // inches = microsecondsToInches(duration);
  139. // cm = microsecondsToCentimeters(duration);
  140.  
  141. lcd.display();
  142.  
  143.  
  144.  
  145. delay(500);
  146. }
  147.  
  148. long microsecondsToInches(long microseconds) {
  149. return microseconds / 74 / 2;
  150. }
  151.  
  152. long microsecondsToCentimeters(long microseconds) {
  153. return microseconds / 29 / 2;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement