#include <LiquidCrystal.
h>
LiquidCrystal lcd(3, 5, 9, 10, 11, 12);
#define NUM_SAMPLES 10
int sum = 0; // sum of samples taken
unsigned char sample_count = 0; // current sample number
float voltage = 0.0; // calculated voltage
int green = 2 ;
void setup()
pinMode(green, OUTPUT);
digitalWrite(green, LOW);
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("FOOT STEP");
lcd.setCursor(0, 1);
lcd.print("POWER GENERATION");
delay(1000);
delay(1000);
delay(1000);
delay(1000);
//Serial.begin(9600);
lcd.clear();
lcd.print("Volt Generated:-");
void loop()
// take a number of analog samples and add them up
/*
while (sample_count < NUM_SAMPLES)
sum += analogRead(A0);
sample_count++;
delay(10);
*/
// calculate the voltage
// use 5.0 for a 5.0V ADC reference voltage
// 5.015V is the calibrated reference voltage
sum = analogRead(A0);
if(sum>=180)
digitalWrite(green, HIGH);
voltage = ((float)sum * 5.015) / 1024.0;
// send voltage for display on Serial Monitor
// voltage multiplied by 11 when using voltage divider that
// divides by 11. 11.132 is the calibrated voltage divide
/* Serial.print(voltage * 11.132);
Serial.println (" Voltage");
*/
voltage = ((float)voltage * 11.132);
lcd.setCursor(0, 1);
lcd.print(voltage);
delay(400);
sample_count = 0;
sum = 0;
digitalWrite(green, LOW);