Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **ESP8288 UNO**
- RX--------RX (not using any logic converter as 5v seems to be working fine)
- TX--------TX
- VCC-------3.3V (powered breadboad powersupply connected with 12v 7amp PS)
- GND-------GND (arduino GND and breadboard gnd are connected)
- GPIO0 ----PULLED UP (with tactile switch)
- GPIO2-----NOT CONNECTED
- RESET-----PULLED UP (with tactile switch)
- #include <Wire.h>
- #include <LCD.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7); // 0x3F is my backpack Address
- #define pulsein 13 //connect pulse pin in 13 pin no.
- float one_pulse=1,units=0,pulse;
- int piezoPin = 8;
- void setup()
- {
- pinMode(pulsein,INPUT);
- lcd.begin(20, 4); // ** LCD display 20x4 **
- lcd.setBacklightPin(3,POSITIVE);
- lcd.setBacklight(HIGH);
- }
- void loop()
- {
- lcd.clear();
- while(1)
- {
- if(digitalRead(pulsein))
- {
- pulse++;
- while(digitalRead(pulsein));
- }
- units=one_pulse*pulse; //total units consumed
- lcd.setCursor(0,0);
- lcd.print("units: "); //display toatl units
- lcd.print(units);
- lcd.setCursor(0,1);
- lcd.print("pulse: "); //dipaly pulse
- lcd.print(pulse);
- }
- }
Add Comment
Please, Sign In to add comment