[SOLVE] Please help... noob here.... Servo.read().

i am trying to get the distance between the previous angle and present angle of a servo but i always get this error message can any one help me please??? thanks
error message:
Arduino: 1.8.1 (Windows 8.1), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

C:\Users\Run_piggy\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:98:0: warning: “MPU6050_AUX_VDDIO” redefined

#define MPU6050_AUX_VDDIO MPU6050_D7

^

C:\Users\Run_piggy\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:3:0: note: this is the location of the previous definition

#define MPU6050_AUX_VDDIO 0x01 // R/W

^

C:\Users\Run_piggy\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:349:0: warning: “MPU6050_FIFO_EN” redefined

#define MPU6050_FIFO_EN MPU6050_D6

^

C:\Users\Run_piggy\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:14:0: note: this is the location of the previous definition

#define MPU6050_FIFO_EN 0x23 // R/W

^

C:\Users\Run_piggy\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:419:1: warning: ‘typedef’ was ignored in this declaration

};

^

C:\Users\Run_piggy\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino: In function ‘void loop()’:

gy_521_send_serial:596: error: no match for ‘operator+’ (operand types are ‘double’ and ‘Servo’)

double Delta = Prev + Output;

^

gy_521_send_serial:605: error: no match for ‘operator=’ (operand types are ‘Servo’ and ‘float’)

Output = g_fisOutput[0];

^

C:\Users\Romano\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:605:12: note: candidates are:

In file included from C:\Users\Romano\Downloads\gy_521_send_serial (1)\gy_521_send_serial\gy_521_send_serial.ino:529:0:

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:94:7: note: Servo& Servo::operator=(const Servo&)

class Servo

^

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:94:7: note: no known conversion for argument 1 from ‘float’ to ‘const Servo&’

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:94:7: note: Servo& Servo::operator=(Servo&&)

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:94:7: note: no known conversion for argument 1 from ‘float’ to ‘Servo&&’

exit status 1
no match for ‘operator+’ (operand types are ‘double’ and ‘Servo’)

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

here’s my code:

float Prev = Output.read();
  float Delta = Prev - Output;

Output is the present angle of the servo and Prev is the previous output.
thanks…

I'm guessing (because I can't see your code - hint) that you've got a servo object called Output.

yes i want to post my whole code but it exceeds the maximum limit for posting replies.
here’s a part of it.

// Number of inputs to the fuzzy inference system
const int fis_gcI = 2;
// Number of outputs to the fuzzy inference system
const int fis_gcO = 1;
// Number of rules to the fuzzy inference system
const int fis_gcR = 17;

FIS_TYPE g_fisInput[fis_gcI];
FIS_TYPE g_fisOutput[fis_gcO];
int DeltaX;
int Prev;
////////////////////////Servo setup//////////////////////////
#include <Servo.h>
Servo Output;
void setup()
{      
  int error;
  uint8_t c;


  Serial.begin(19200);
  Wire.begin();


  error = MPU6050_read (MPU6050_WHO_AM_I, &c, 1);
  error = MPU6050_read (MPU6050_PWR_MGMT_2, &c, 1);
  MPU6050_write_reg (MPU6050_PWR_MGMT_1, 0);
  calibrate_sensors();  
  set_last_read_angle_data(millis(), 0, 0, 0, 0, 0, 0);
  ////////////////////set up fuzzy////////////////////
  Output.attach (9);
  float Output = 90;
  
}


void loop()
{
  int error;
  double dT;
  accel_t_gyro_union accel_t_gyro;
  error = read_gyro_accel_vals((uint8_t*) &accel_t_gyro);
  unsigned long t_now = millis();
  // Convert gyro values to degrees/sec
  float FS_SEL = 131;
  float gyro_x = (accel_t_gyro.value.x_gyro - base_x_gyro)/FS_SEL;
  float gyro_y = (accel_t_gyro.value.y_gyro - base_y_gyro)/FS_SEL;
  float gyro_z = (accel_t_gyro.value.z_gyro - base_z_gyro)/FS_SEL;
  float accel_x = accel_t_gyro.value.x_accel;
  float accel_y = accel_t_gyro.value.y_accel;
  float accel_z = accel_t_gyro.value.z_accel;
  float RADIANS_TO_DEGREES = 180/3.14159;
  float accel_angle_y = atan(-1*accel_x/sqrt(pow(accel_y,2) + pow(accel_z,2)))*RADIANS_TO_DEGREES;
  float accel_angle_x = atan(accel_y/sqrt(pow(accel_x,2) + pow(accel_z,2)))*RADIANS_TO_DEGREES;

  float accel_angle_z = 0;
  
  // Compute the (filtered) gyro angles
  float dt =(t_now - get_last_time())/1000.0;
  float gyro_angle_x = gyro_x*dt + get_last_x_angle();
  float gyro_angle_y = gyro_y*dt + get_last_y_angle();
  float gyro_angle_z = gyro_z*dt + get_last_z_angle();
  
  // Compute the drifting gyro angles
  float unfiltered_gyro_angle_x = gyro_x*dt + get_last_gyro_x_angle();
  float unfiltered_gyro_angle_y = gyro_y*dt + get_last_gyro_y_angle();
  float unfiltered_gyro_angle_z = gyro_z*dt + get_last_gyro_z_angle();
  
  // Apply the complementary filter to figure out the change in angle - choice of alpha is
  // estimated now.  Alpha depends on the sampling rate...
  float alpha = 0.96;
  float angle_x = alpha*gyro_angle_x + (1.0 - alpha)*accel_angle_x;
  float angle_y = alpha*gyro_angle_y + (1.0 - alpha)*accel_angle_y;
  float angle_z = gyro_angle_z;  //Accelerometer doesn't give z-angle
  
  // Update the saved data with the latest values
  set_last_read_angle_data(t_now, angle_x, angle_y, angle_z, unfiltered_gyro_angle_x, unfiltered_gyro_angle_y, unfiltered_gyro_angle_z);

  float Prev = Output.read();
  float Delta = Prev + Output;
  // Read Input: tilt
    g_fisInput[0] = angle_y;
    // Read Input: delta_x
    g_fisInput[1] = Delta;

    g_fisOutput[0] = 0;

    fis_evaluate();
    Output = g_fisOutput[0];
    // Set output vlaue: output
    Output.write (g_fisOutput[0]);

  // Send the data to the serial port
  Serial.print(F("DEL:"));              //Delta T
  Serial.print(dt, DEC);
  Serial.print(F("#ACC:"));              //Accelerometer angle
  Serial.print(accel_angle_x, 2);
  Serial.print(F(","));
  Serial.print(accel_angle_y, 2);
  Serial.print(F(","));
  Serial.print(accel_angle_z, 2);
  Serial.print(F("#GYR:"));
  Serial.print(unfiltered_gyro_angle_x, 2);        //Gyroscope angle
  Serial.print(F(","));
  Serial.print(unfiltered_gyro_angle_y, 2);
  Serial.print(F(","));
  Serial.print(unfiltered_gyro_angle_z, 2);
  Serial.print(F("#FIL:"));             //Filtered angle
  Serial.print(angle_x, 2);
  Serial.print(F(","));
  Serial.print(angle_y, 2);
  Serial.print(F(","));
  Serial.print(angle_z, 2);
  Serial.println(F(""));
  
  // Delay so we don't swamp the serial port
  delay(5);
}

Here's part of my answer:.

float Prev = Output.read();
  float Delta = Prev + Output;

Prev is a float. Output is a Servo.

Have you tried adding a Servo to a float?

Try changing the name of either the Output servo or the Output variable

ohhh i get it... thanks.... i should change the name for the Output.