0% found this document useful (0 votes)
9 views1 page

Project

This document contains an Arduino sketch that utilizes a LiquidCrystal_I2C library to display step counts on an LCD. It reads analog values from a Piezo disc connected to an analog pin and increments a step count when a threshold is exceeded. The LCD updates to show the current step count each time a step is detected.

Uploaded by

duarisamydharani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Project

This document contains an Arduino sketch that utilizes a LiquidCrystal_I2C library to display step counts on an LCD. It reads analog values from a Piezo disc connected to an analog pin and increments a step count when a threshold is exceeded. The LCD updates to show the current step count each time a step is detected.

Uploaded by

duarisamydharani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <Wire.

h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 columns, 2 rows

const int piezoPin = A0; // Analog pin for Piezo disc


int stepCount = 0;

void setup() {
lcd.init(); // Initialize LCD
lcd.backlight(); // Turn on backlight

// You may need to adjust the sensitivity and threshold for your Piezo disc
// You might also need to use a resistor in series with the Piezo disc for better
performance
}

void loop() {
// Read analog value from Piezo disc
int piezoValue = analogRead(piezoPin);

// Check if a step is detected based on your threshold


if (piezoValue > 100) {
stepCount++;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Steps: ");
lcd.print(stepCount);
}

// Other operations or display updates can be added here


delay(100); // Adjust delay as necessary
}

You might also like