Guest User

Untitled

a guest
Nov 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. **ESP8288 UNO**
  2. RX--------RX (not using any logic converter as 5v seems to be working fine)
  3. TX--------TX
  4. VCC-------3.3V (powered breadboad powersupply connected with 12v 7amp PS)
  5. GND-------GND (arduino GND and breadboard gnd are connected)
  6. GPIO0 ----PULLED UP (with tactile switch)
  7. GPIO2-----NOT CONNECTED
  8. RESET-----PULLED UP (with tactile switch)
  9.  
  10. #include <Wire.h>
  11. #include <LCD.h>
  12. #include <LiquidCrystal_I2C.h>
  13.  
  14. LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7); // 0x3F is my backpack Address
  15.  
  16. #define pulsein 13 //connect pulse pin in 13 pin no.
  17. float one_pulse=1,units=0,pulse;
  18. int piezoPin = 8;
  19.  
  20. void setup()
  21. {
  22. pinMode(pulsein,INPUT);
  23. lcd.begin(20, 4); // ** LCD display 20x4 **
  24. lcd.setBacklightPin(3,POSITIVE);
  25. lcd.setBacklight(HIGH);
  26. }
  27. void loop()
  28. {
  29. lcd.clear();
  30. while(1)
  31. {
  32. if(digitalRead(pulsein))
  33. {
  34. pulse++;
  35.  
  36. while(digitalRead(pulsein));
  37. }
  38. units=one_pulse*pulse; //total units consumed
  39. lcd.setCursor(0,0);
  40. lcd.print("units: "); //display toatl units
  41. lcd.print(units);
  42. lcd.setCursor(0,1);
  43. lcd.print("pulse: "); //dipaly pulse
  44. lcd.print(pulse);
  45. }
  46. }
Add Comment
Please, Sign In to add comment