Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung | |||
bauteile:mc33926 [2017/07/13 17:30] d.golovko [Motorgeschwindigkeit mit Encoder messen] |
bauteile:mc33926 [2017/07/13 17:30] (aktuell) d.golovko |
||
---|---|---|---|
Zeile 7: | Zeile 7: | ||
===== Motorgeschwindigkeit mit Encoder messen ===== | ===== Motorgeschwindigkeit mit Encoder messen ===== | ||
- | (Code für einen Motor | + | (Code für einen Motor) |
<code cpp> | <code cpp> | ||
Zeile 14: | Zeile 14: | ||
const int IN2 = 11; | const int IN2 = 11; | ||
const int CS = A7; // pin to measure the motor current (connected to the driver FB feedback pin) | const int CS = A7; // pin to measure the motor current (connected to the driver FB feedback pin) | ||
- | const int ENCODERA = 2; | + | const int ENCODERA = 2; // encoder sensor pin A |
- | const int ENCODERB = 3; | + | const int ENCODERB = 3; // encoder sensor pin B |
byte encoder0PinALast; | byte encoder0PinALast; | ||
int duration;//the number of the pulses | int duration;//the number of the pulses |