# Backspin and coggling on nema 23

**URL:** <https://community.simplefoc.com/t/backspin-and-coggling-on-nema-23/1389>\
**Category:** hardware support\
**Created:** [November 23, 2021, 1:46pm UTC](https://community.simplefoc.com/t/backspin-and-coggling-on-nema-23/1389 "2021-11-23T13:46:13Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Antun\_Skuric](https://community.simplefoc.com/user_avatar/community.simplefoc.com/antun_skuric/32/21_2.png) [@Antun\_Skuric](https://community.simplefoc.com/u/Antun_Skuric)\
**Post date:** [November 25, 2021, 11:18am UTC](https://community.simplefoc.com/t/backspin-and-coggling-on-nema-23/1389/7 "2021-11-25T11:18:17Z")

</div>

Hey @Pipe  
Please use the `motor.shaft_angle` and `motor.shaft_velocity` when using the sensor with FOC.  
When the sensor is used for some standalone application then it makes sense to call `getAngle` and `getVelocity`. But when using it with FOC the sensor variables are used in the algorithm and the motor variables are updated with them, calling the sensor `getAngle` and `getVelocity` outside the algorithm can result in some strange behavior, as you’ve already seen.

So I’d suggest you add this in your loop:

```cpp
Serial.print(motor.shaft_angle);
Serail.print("\t");
Serial.print(motor.shaft_velocity);
Serail.print("\t");
Serial.println(motor.voltage.q);

```

Or even better is using the monitoring:

```cpp

void setup(){
....
  // comment out if not needed
  motor.useMonitoring(Serial);
  motor.monitoring_downsample=1;
  motor.monitor_variables = _MON_VOLT_Q | _MON_VEL | _MON_ANGLE;
....
}
void loop(){
....
  motor.monitor();
....
}

```

---

_[View the full topic](https://community.simplefoc.com/t/backspin-and-coggling-on-nema-23/1389)._
