#include Servo serv; int pin = A0; //input Velostat pin int pinServo = 9; //servo pin float sensorVal; float voltage; float voltageCal; float voltageScale; float angle; float Weight; //Calibration float offset = 2.585; float scale = -0.0008; float bias = 11; void setup() { Serial.begin(9600); serv.attach(pinServo); //attach servo pin pinMode(pin,INPUT_PULLUP); digitalWrite(pin, HIGH); } void loop() { sensorVal = analogRead(pin); voltage = sensorVal * (5.0 / 1023.0); //voltageCal = voltage - bias; //voltageScale = abs(voltageCal / scale); //voltageScale = (scale*voltageCal)-offset; angle = voltage*54.54; //angle = map(voltage,0,3.3,0,180); //Weight = (voltage-offset)/scale; //Serial Printing Serial.print(sensorVal); Serial.print(" , "); Serial.print(voltage); Serial.print(" , "); Serial.print(Weight); Serial.print(" , "); Serial.println(angle); serv.write(angle); delay(500); }