Skip to content

Commit fdab4c4

Browse files
committed
UPDATE readme
1 parent 78d37f0 commit fdab4c4

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

ArduinoCode/motor_control_encoder.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ BLDCMotor motor = BLDCMotor(9,10,11,&counter[ENCODER_1],A0,A1,11,8196);
99
//BLDCMotorint(phA,int phB,int phC, long* counter, int encA, int encB , int pp, int cpr)
1010

1111
double angle_sp = PI/8;
12+
double voltage_sp = 2;
13+
double velocity_sp = 1;
1214
int t = 0;
1315

1416
// encoder interrupt init
@@ -47,10 +49,17 @@ void loop() {
4749
if (!(t%100)){
4850
t = 0;
4951
angle_sp = -angle_sp;
52+
voltage_sp = -voltage_sp;
53+
velocity_sp = -velocity_sp;
5054
}
5155

56+
// Uncomment line to see different loop in action
57+
// Set phase voltages using FOC
58+
//motor.setVoltage(voltage_sp);
59+
// Set velocity of the motor
60+
//motor.setVelocity(velocity_sp);
61+
// Set referent position P+PI
5262
motor.setPosition(angle_sp);
53-
//Serial.println(*motor._encoderPosition);
5463
}
5564

5665

Images/position.png

27.6 KB
Loading

Images/velocity.png

20.2 KB
Loading

Images/voltage.png

12.6 KB
Loading

0 commit comments

Comments
 (0)