Guest User

Untitled

a guest
Apr 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(6, 5, 3, 2, 1, 0);
  3. int data=A0;
  4. int start=7;
  5. int count=0;
  6. unsigned long temp=0;
  7.  
  8. byte customChar1[8] = {0b00000,0b00000,0b00011,0b00111,0b01111,0b01111,0b01111,0b01111};
  9. byte customChar2[8] = {0b00000,0b11000,0b11100,0b11110,0b11111,0b11111,0b11111,0b11111};
  10. byte customChar3[8] = {0b00000,0b00011,0b00111,0b01111,0b11111,0b11111,0b11111,0b11111};
  11. byte customChar4[8] = {0b00000,0b10000,0b11000,0b11100,0b11110,0b11110,0b11110,0b11110};
  12. byte customChar5[8] = {0b00111,0b00011,0b00001,0b00000,0b00000,0b00000,0b00000,0b00000};
  13. byte customChar6[8] = {0b11111,0b11111,0b11111,0b11111,0b01111,0b00111,0b00011,0b00001};
  14. byte customChar7[8] = {0b11111,0b11111,0b11111,0b11111,0b11110,0b11100,0b11000,0b10000};
  15. byte customChar8[8] = {0b11100,0b11000,0b10000,0b00000,0b00000,0b00000,0b00000,0b00000};
  16. void setup() {
  17. lcd.begin(16, 2);
  18. lcd.createChar(1, customChar1);
  19. lcd.createChar(2, customChar2);
  20. lcd.createChar(3, customChar3);
  21. lcd.createChar(4, customChar4);
  22. lcd.createChar(5, customChar5);
  23. lcd.createChar(6, customChar6);
  24. lcd.createChar(7, customChar7);
  25. lcd.createChar(8, customChar8);
  26.  
  27. pinMode(data,INPUT);
  28. pinMode(start,INPUT_PULLUP);
  29.  
  30.  
  31.  
  32.  
  33. }
  34.  
  35. void loop() {
  36. // put your main code here, to run repeatedly:
  37. lcd.setCursor(0, 0);
  38. lcd.print("Place The Finger");
  39. lcd.setCursor(0, 1);
  40. lcd.print("And Press Start");
  41.  
  42. while(digitalRead(start)>0);
  43.  
  44. lcd.clear();
  45. temp=millis();
  46.  
  47. while(millis()<(temp+10000))
  48. {
  49. if(analogRead(data)<100)
  50. {
  51. count=count+1;
  52.  
  53. lcd.setCursor(6, 0);
  54. lcd.write(byte(1));
  55. lcd.setCursor(7, 0);
  56. lcd.write(byte(2));
  57. lcd.setCursor(8, 0);
  58. lcd.write(byte(3));
  59. lcd.setCursor(9, 0);
  60. lcd.write(byte(4));
  61.  
  62. lcd.setCursor(6, 1);
  63. lcd.write(byte(5));
  64. lcd.setCursor(7, 1);
  65. lcd.write(byte(6));
  66. lcd.setCursor(8, 1);
  67. lcd.write(byte(7));
  68. lcd.setCursor(9, 1);
  69. lcd.write(byte(8));
  70.  
  71. while(analogRead(data)<100);
  72.  
  73. lcd.clear();
  74. }
  75. }
  76.  
  77. lcd.clear();
  78. lcd.setCursor(0, 0);
  79. count=count*6;
  80. lcd.setCursor(2, 0);
  81. lcd.write(byte(1));
  82. lcd.setCursor(3, 0);
  83. lcd.write(byte(2));
  84. lcd.setCursor(4, 0);
  85. lcd.write(byte(3));
  86. lcd.setCursor(5, 0);
  87. lcd.write(byte(4));
  88.  
  89. lcd.setCursor(2, 1);
  90. lcd.write(byte(5));
  91. lcd.setCursor(3, 1);
  92. lcd.write(byte(6));
  93. lcd.setCursor(4, 1);
  94. lcd.write(byte(7));
  95. lcd.setCursor(5, 1);
  96. lcd.write(byte(8));
  97. lcd.setCursor(7, 1);
  98. lcd.print(count);
  99. lcd.print(" BPM");
  100. temp=0;
  101. while(1);
  102.  
  103. }
Add Comment
Please, Sign In to add comment