IDE compiler error?

I have installed the library SimpleFOC version 2.0 Using Arduino IDE 1.8.13 Copied code from this page: https://docs.simplefoc.com/simplefoc_pendulum

Compiler stops at: BLDCDriver3PWM motor = BLDCDriver3PWM(9, 10, 11, 8);

with this error:
Arduino: 1.8.13 (Windows 10), Board: “Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)”

FOC_code_for_inverted_pend:10:16: error: conflicting declaration ‘BLDCDriver3PWM motor’

BLDCDriver3PWM motor = BLDCDriver3PWM(9, 10, 11, 8);

            ^~~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino:8:11: note: previous declaration as ‘BLDCMotor motor’

BLDCMotor motor = BLDCMotor(11);

       ^~~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino: In function ‘void setup()’:

FOC_code_for_inverted_pend:34:3: error: ‘driver’ was not declared in this scope

driver.voltage_power_supply = 12;

^~~~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino:34:3: note: suggested alternative: ‘div’

driver.voltage_power_supply = 12;

^~~~~~

div

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino: In function ‘void loop()’:

FOC_code_for_inverted_pend:74:25: error: ‘sign’ was not declared in this scope

   target_voltage = -sign(pendulum.getVelocity())*driver.voltage_power_supply*0.4;

                     ^~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino:74:25: note: suggested alternative: ‘sin’

   target_voltage = -sign(pendulum.getVelocity())*driver.voltage_power_supply*0.4;

                     ^~~~

                     sin

FOC_code_for_inverted_pend:74:54: error: ‘driver’ was not declared in this scope

   target_voltage = -sign(pendulum.getVelocity())*driver.voltage_power_supply*0.4;

                                                  ^~~~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino:74:54: note: suggested alternative: ‘div’

   target_voltage = -sign(pendulum.getVelocity())*driver.voltage_power_supply*0.4;

                                                  ^~~~~~

                                                  div

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino: In function ‘float controllerLQR(float, float, float)’:

FOC_code_for_inverted_pend:105:15: error: ‘driver’ was not declared in this scope

if(abs(u) > driver.voltage_power_supply*0.7) u = sign(u)driver.voltage_power_supply0.7;

           ^~~~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino:105:15: note: suggested alternative: ‘div’

if(abs(u) > driver.voltage_power_supply*0.7) u = sign(u)driver.voltage_power_supply0.7;

           ^~~~~~

           div

FOC_code_for_inverted_pend:105:52: error: ‘sign’ was not declared in this scope

if(abs(u) > driver.voltage_power_supply*0.7) u = sign(u)driver.voltage_power_supply0.7;

                                                ^~~~

G:\Keshka\Documents\Arduino\FOC_code_for_inverted_pend\FOC_code_for_inverted_pend.ino:105:52: note: suggested alternative: ‘sin’

if(abs(u) > driver.voltage_power_supply*0.7) u = sign(u)driver.voltage_power_supply0.7;

                                                ^~~~

                                                sin

exit status 1

conflicting declaration ‘BLDCDriver3PWM motor’

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

PS. I can not go to my profile page to add my photo. Get 404 not found error

Looking at code differences from https://docs.simplefoc.com/position_control_example
and https://docs.simplefoc.com/simplefoc_pendulum

this line in pendulum
BLDCDriver3PWM motor = BLDCDriver3PWM(9, 10, 11, 8);

is this in position control
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11, 8);

using the line from position control instead of said line from pendulum and it compiles fine now

Keshka

Thanks a lot for the heads up, I just did a lot of refactoring in the docs and unfortunately this is to be expected :smiley:
I am not the best typer :smiley:

I will update the docs right away!