You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/simplefoc_library/code/sensors/magnetic/magnetic_sensor_pwm.md
+3-26Lines changed: 3 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ There are two ways to use magnetic sensor implemented within this library:
126
126
127
127
### Position sensor for FOC algorithm
128
128
129
-
To use the ensor with the FOC algorithm implemented in this library, once when you have initialized `sensor.init()` (and possibly started the interrupts) you just need to link it to the motor by executing:
129
+
To use the sensor with the FOC algorithm implemented in this library, once when you have initialized `sensor.init()` (and possibly started the interrupts) you just need to link it to the motor by executing:
When calling `getVelocity` it will only calculate the velocity if the elapsed time from the previous call is longer than the time specified in teh variable `min_elapsed_time` (default 100us). If the elapsed time from the last call is shorter than `min_elapsed_time` the function will return previously calculated value. Variable `min_elapsed_time` can be changed easily if necessary:
149
+
When calling `getVelocity` it will only calculate the velocity if the elapsed time from the previous call is longer than the time specified in the variable `min_elapsed_time` (default 100us). If the elapsed time from the last call is shorter than `min_elapsed_time` the function will return previously calculated value. Variable `min_elapsed_time` can be changed easily if necessary:
150
150
151
151
```cpp
152
152
sensor.min_elapsed_time = 0.0001; // 100us by default
When calling `getVelocity` it will only calculate the velocity if the elapsed time from the previous call is longer than the time specified in teh variable `min_elapsed_time` (default 100us). If the elapsed time from the last call is shorter than `min_elapsed_time` the function will return previously calculated value. Variable `min_elapsed_time` can be changed easily if necessary:
161
-
162
-
```cpp
163
-
sensor.min_elapsed_time = 0.0001; // 100us by default
When calling `getVelocity` it will only calculate the velocity if the elapsed time from the previous call is longer than the time specified in teh variable `min_elapsed_time` (default 100us). If the elapsed time from the last call is shorter than `min_elapsed_time` the function will return previously calculated value. Variable `min_elapsed_time` can be changed easily if necessary:
172
-
173
-
```cpp
174
-
sensor.min_elapsed_time = 0.0001; // 100us by default
175
-
```
176
-
</blockquote>
177
-
178
-
179
-
180
157
Here is a quick example for AS5048A magnetic sensor using its PWM output:
0 commit comments