Force sensor with Arduino

Hello everyone, I'm a bit confused, this code is used for counting steps by switches, I found the code in this video: Arduino counter with LCD display and push button tutorial. - YouTube , my question howcan I convert this to two force sensor each one is replaced with switch.
Here's the code:

#include <LiquidCrystal.h> //Library LiquidCrystal

const int rs = 12, en = 11, d4 = 7, d5 = 6, d6 = 5, d7 = 4;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const int Up_buttonPin = 2;
const int Down_buttonPin = 3;

int buttonPushCounter = 0; // counter for the number of button presses
int up_buttonState = 0; // current state of the up button
int up_lastButtonState = 0; // previous state of the up button

int down_buttonState = 0; // current state of the up button
int down_lastButtonState = 0; // previous state of the up button
bool bPress = false;

void setup()
{
Serial.begin(9600);
pinMode( Up_buttonPin , INPUT_PULLUP);
pinMode( Down_buttonPin , INPUT_PULLUP);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Counter Value:");
lcd.setCursor(2, 1);
lcd.print(buttonPushCounter);
}
void loop()
{
checkUp();
checkDown();

if ( bPress)
{
bPress = false;
lcd.setCursor(2, 1);
lcd.print(" ");
lcd.setCursor(2, 1);
lcd.print(buttonPushCounter);
}
}
void checkUp()
{
up_buttonState = digitalRead(Up_buttonPin);
if (up_buttonState != up_lastButtonState) // compare the buttonState to its previous state
{
if (up_buttonState == LOW) // if the state has changed, increment the counter
{
bPress = true; // if the current state is HIGH then the button went from off to on:
buttonPushCounter++;
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
}
else {
Serial.println("off"); // if the current state is LOW then the button went from on to off:
}
delay(50); // Delay a little bit to avoid bouncing
}

up_lastButtonState = up_buttonState; // save the current state as the last state, for next time through the loop
}

void checkDown()
{
down_buttonState = digitalRead(Down_buttonPin);
if (down_buttonState != down_lastButtonState) // compare the buttonState to its previous state
{
if (down_buttonState == LOW) // if the state has changed, increment the counter
{
bPress = true;
buttonPushCounter--; // if the current state is HIGH then the button went from off to on:
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
} else {
Serial.println("off"); // if the current state is LOW then the button went from on to off:
}
delay(50); // Delay a little bit to avoid bouncing
}
down_lastButtonState = down_buttonState; // save the current state as the last state, for next time through the loop

}

@ibrahimalzoubi, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project (see About the Installation & Troubleshooting category).

Please read How to get the best out of this forum and next apply code tags to the code in your post.

I don’t understand your question…

What force sensors are you using? (datasheet please), and the sketch you provided already uses switches (buttons).

When you post code, please use code tags - read the forum guides !

what's code tags?

Did you read the link I provided?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.