Quickshifther pit bike

I am trying to make a quickshifter for a pitbike. The thing is that I have a force sensor that, at X pressure, is to be able to regulate the sensitivity. When it reaches the indicated value, I want it to give a signal to a relay for a few milliseconds. what I have so far gives me the signal for the relay to enter but if the senser is kept pressed, the relay has entered again and I would like that in order for the relay to activate again it has to go below the indicated value.

Welcome to the forum

Please post your current sketch, using code tags when you do

Look up state machines

I'm new to this, so I know if I should remove the delay and put millis

#define RELE 13
#define SENSOR A0
void setup()
{
 
  pinMode (RELE, OUTPUT);
  pinMode (SENSOR,INPUT);
  Serial.begin(9600);
  


 if (analogRead(SENSOR) >400) digitalWrite(RELE, HIGH);
  digitalWrite (RELE, LOW);
  delay(160);


}


void loop(){
 
 
  
}

Delays don’t matter in setup as it only runs once. It won’t do much though as it only runs once.

I want it to run once every time I step on the sensor

#define RELE 13
#define SENSOR A0
void setup()
{
 
  pinMode (RELE, OUTPUT);
  pinMode (SENSOR,INPUT);
  Serial.begin(9600);
 


 


}


void loop(){
 
 if (analogRead(SENSOR) >900) digitalWrite(RELE, HIGH);
  delay(10);
  digitalWrite (RELE, LOW);
  delay(160);

  
}

Syntax is important including {}

See: File -> Examples -> 02.Digital -> StateChangeDetection
That will show you how to "do something once, each time a condition occurs". The example condition is "(digitalRead(buttonPin) == HIGH)" (the button is being pressed) while yours will be "(analogRead(SENSOR) > 900)" (pressure is above a threshold).

Ok, the sensor is analog.

What is the analog reading when the sensor is NOT pressed?

Yes. I know. I saw that you were using analogRead() and comparing the result to a threshold (400 in one case, 900 in another). That is why I explained the difference between the example and what you need for an analog input.