Skip to content

Commit b774a73

Browse files
committed
minimal example
1 parent a3482df commit b774a73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/angle_control/angle_control.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ BLDCMotor motor = BLDCMotor(9, 10, 11, 11, 8);
1414
// - cpr - counts per rotation (cpm=ppm*4)
1515
// - index pin - (optional input)
1616
Encoder encoder = Encoder(arduinoInt1, arduinoInt2, 32768, 4);
17+
// interrupt ruotine intialisation
18+
void doA(){encoder.handleA();}
19+
void doB(){encoder.handleB();}
1720

1821
void setup() {
1922
// debugging port
2023
Serial.begin(115200);
2124

22-
2325
// check if you need internal pullups
2426
// Pullup::EXTERN - external pullup added
2527
// Pullup::INTERN - needs internal arduino pullup
2628
encoder.pullup = Pullup::EXTERN;
29+
2730
// initialise encoder hardware
28-
encoder.init();
29-
30-
encoder.enableInterrupt();
31+
encoder.init(doA, doB);
3132

3233
// set driver type
3334
// DriverType::unipolar

0 commit comments

Comments
 (0)