Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
bauteile:mc33926 [2017/07/13 16:39] d.golovko |
bauteile:mc33926 [2017/07/13 17:30] (aktuell) d.golovko |
||
---|---|---|---|
Zeile 6: | Zeile 6: | ||
===== Motorgeschwindigkeit mit Encoder messen ===== | ===== Motorgeschwindigkeit mit Encoder messen ===== | ||
+ | |||
+ | (Code für einen Motor) | ||
<code cpp> | <code cpp> | ||
Zeile 11: | Zeile 13: | ||
const int IN1 = 9; | const int IN1 = 9; | ||
const int IN2 = 11; | const int IN2 = 11; | ||
- | const int ENCODERA = 2; | + | const int CS = A7; // pin to measure the motor current (connected to the driver FB feedback pin) |
- | const int ENCODERB = 3; | + | const int ENCODERA = 2; // encoder sensor pin A |
+ | 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 | ||
Zeile 42: | Zeile 45: | ||
Serial.print(" "); | Serial.print(" "); | ||
Serial.print("CS: "); | Serial.print("CS: "); | ||
- | Serial.println(analogRead(A0)); | + | Serial.println(CS); |
// ich muss die Variable auf Null setzen, damit ich die nächste Messung durchführen kann: | // ich muss die Variable auf Null setzen, damit ich die nächste Messung durchführen kann: |