Need code for Weight TARE / reset to 0

Hello there,

I want to write a code for "weight tare" (reset to 0) for my resistive force sensor (FSR Interlink 408). The sensor is very responsive and it returns very big values even if I just move it. Also, by letting the sensor untouched the program returns values between 200 and 250.

So, how can I reset this to 0 from start?

This is the code I'm using now:

    int fsrAnalogPin = 1;
    int LEDpin = 11;   
    int fsrReading;   
    int LEDbrightness;  
    void setup(void) {  
      pinMode(LEDpin, OUTPUT); }  
      void loop(void) {  
        fsrReading = analogRead(fsrAnalogPin); 
    Serial.print("Analog reading = "); 
    LEDbrightness = map(fsrReading, 0, 1023, 0, 255);   
    analogWrite(LEDpin, LEDbrightness); 
    delay(150); }

Thank you for helping me! :slight_smile:

Simply measure the value at program start, and subtract that from subsequent measurements.

I suggest to study this excellent tutorial on sensor calibration: