Trying to read the current position of a flex sensor and store it as a variable? NANO ATmega328p
You will need to add this at the start of your code.

int LoggedPosition=100;


Change this line

if (flexSensorReading &lt; 100) {


To this

if (flexSensorReading &lt; LoggedPosition) {


and add this at just before the delay, at the end of the loop() function

if(digitalRead(inPin)){
    LoggedPosition=flexSensorReading;
}