diff --git a/docs/simplefoc_library/code/from_scratch.md b/docs/simplefoc_library/code/from_scratch.md index 2f488bc..6051fb8 100644 --- a/docs/simplefoc_library/code/from_scratch.md +++ b/docs/simplefoc_library/code/from_scratch.md @@ -155,7 +155,7 @@ void setup() { // monitoring port Serial.begin(115200); - // initialise encoder hardware + // initialise sensor hardware sensor.init(); Serial.println("Sensor ready"); @@ -192,7 +192,7 @@ void setup() { Serial.begin(115200); // initialise encoder hardware - sensor.init(); + encoder.init(); // hardware interrupt enable encoder.enableInterrupts(doA, doB); @@ -203,9 +203,9 @@ void setup() { void loop() { // IMPORTANT // read sensor and update the internal variables - sensor.update(); + encoder.update(); // display the angle and the angular velocity to the terminal - Serial.print(sensor.getAngle()); + Serial.print(encoder.getAngle()); Serial.print("\t"); Serial.println(sensor.getVelocity()); } @@ -1447,4 +1447,4 @@ Once the current control works well you can proceed to the velocity and angle mo - To go from the current control to the angle control you just need to change the `motor.controller` variable to `MotionControlType::angle` and set the `motor.target` to the desired angle (in radians `RAD`). - You can also use the `Commander` interface to transition to the velocity and angle control modes using the `MC1` and `MC2` commands. -The velocity and angle motion control modes have additional configuration parameters that might be needed to obtain a smooth and stable operation of your motor. You can find more info about these parameters in the [motion control docs](closed_loop_motion_control). \ No newline at end of file +The velocity and angle motion control modes have additional configuration parameters that might be needed to obtain a smooth and stable operation of your motor. You can find more info about these parameters in the [motion control docs](closed_loop_motion_control).