Skip to content

Commit bbd0c62

Browse files
committed
added serial output to initFOC
1 parent 5571330 commit bbd0c62

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

docs/simplefoc_library/code/from_scratch.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,10 @@ void setup() {
825825
return;
826826
}
827827
// align sensor and start FOC
828-
motor.initFOC();
828+
if(!motor.initFOC()){
829+
Serial.println("FOC init failed!");
830+
return;
831+
}
829832

830833
// set the initial motor target
831834
motor.target = 2; // Volts
@@ -913,7 +916,10 @@ void setup() {
913916
return;
914917
}
915918
// align sensor and start FOC
916-
motor.initFOC();
919+
if(!motor.initFOC()){
920+
Serial.println("FOC init failed!");
921+
return;
922+
}
917923
918924
// set the initial motor target
919925
motor.target = 2; // Volts
@@ -998,7 +1004,10 @@ void setup() {
9981004
// initialize motor
9991005
motor.init();
10001006
// align sensor and start FOC
1001-
motor.initFOC();
1007+
if(!motor.initFOC()){
1008+
Serial.println("FOC init failed!");
1009+
return;
1010+
}
10021011

10031012
// set the initial motor target
10041013
motor.target = 2; // Volts
@@ -1144,7 +1153,10 @@ void setup() {
11441153
return;
11451154
}
11461155
// align sensor and start FOC
1147-
motor.initFOC();
1156+
if(!motor.initFOC()){
1157+
Serial.println("FOC init failed!");
1158+
return;
1159+
}
11481160

11491161
// set the initial motor target
11501162
motor.target = 2; // Volts
@@ -1250,7 +1262,10 @@ void setup() {
12501262
return;
12511263
}
12521264
// align sensor and start FOC
1253-
motor.initFOC();
1265+
if(!motor.initFOC()){
1266+
Serial.println("FOC init failed!");
1267+
return;
1268+
}
12541269
12551270
// set the initial motor target
12561271
motor.target = 2; // Volts
@@ -1355,7 +1370,10 @@ void setup() {
13551370
return;
13561371
}
13571372
// align sensor and start FOC
1358-
motor.initFOC();
1373+
if(!motor.initFOC()){
1374+
Serial.println("FOC init failed!");
1375+
return;
1376+
}
13591377

13601378
// set the initial motor target
13611379
motor.target = 2; // Volts
@@ -1428,3 +1446,5 @@ Once the current control works well you can proceed to the velocity and angle mo
14281446
- To go from the current control to the velocity control you just need to change the `motor.controller` variable to `MotionControlType::velocity` and set the `motor.target` to the desired velocity (in radians per second `RAD/s`).
14291447
- 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`).
14301448
- You can also use the `Commander` interface to transition to the velocity and angle control modes using the `MC1` and `MC2` commands.
1449+
1450+
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).

0 commit comments

Comments
 (0)