Drehimpulsgeber auslesen funktioniert nicht

(deleted)

There is german subforum if you prefer to write in german.

This is the english forum so I write in english. If you can't read english copy this text to the clipboard and paste it into google translation. I'm 100% sure you will understand the translation.

the program you posted contains a lot more than just an encoder. You should start with a code that does nothing more than reading in pulses of an encoder and print it to the serial monitor.

There is a library called newEncoder that can be installed as a zip-library

Depending on your knowledge-level you already have it will take 30 minutes up to 2 hours to learn how to install
a zip-library so you can use it.

As all this is free there are no quality-requierements defined for any kind of explanation. This means oyu will find very bad in most cases pretty short and only in very rare cases a step by step manual that is totally newbee-foolproof

the microcontroller-world is not super-standardised like USB-devices. You have to take of more things than just
"does the plug fit into the socket?"

Post information about your knowledge-level about programming and about electronics.

best regards Stefan

max_ge:
Code:

StefanL war schon so nett und hat Dich aus dem englischen hierher geholt.
Jetzt noch den Code in Codetags - das sind die [</>] Dinger da oben am Editorrand.
Und dann den Moderator bitten die beiden Threads zusammenzufassen - ich hab extra nicht auf den deutschen Beitrag geantwortet - oder den deutschen Teil löschen und hier einfügen

Hallo,

lass erstmal das gesamte Gedöhns weg und programmiere nur die Encoderauswertung mit serialer Ausgabe.
Diese seriale Ausgabe probierst du blockkierfrei und lässt aller 1250ms-1000ms den aktuellen Wert anzeigen.
Simplified Example > Arduino Playground - RotaryEncoders
Hast du externe Pullup bzw. Pulldown Widerständen dran?

just want to count up or down a variable with a rotary encoder.

you need to capture every encoder transition. i've found that i need to use interrupts just when rotating an encoder by hand

posted this while the thread was still under the english section

Immer wieder lesenswert.

Gruß Tommy

Hallo,

lesenswert sicherlich. Aber nicht das jeder deswegen auf die Idee kommt einen handbedienten Encoder mit Interrupts auszulesen. Dafür reicht einfaches Polling solange die loop nicht blockiert. Ansonsten im festen Zyklus auslesen. Und wenn der TO später sein Display auch noch blockierfrei aller 1s aktualisiert, sehe ich aktuell keine Probleme mit reinem Polling.

solange die loop nicht blockiert

Zu dem Thema sage ich nur: OneWire
Das blockiert nicht nur die Loop zeitweise, sondern auch die Interrupts.
Damit ist das nicht ruckelfrei hinzubekommen.

Abhilfen...
A: Bei Betätigungen auf den Dallas verzichten, also gegeneinander verriegeln.

B: Einen µC nehmen, welches beides gleichzeitig kann.
Z.B. STM32 oder den Arduino Due, die haben die Decoder in Hardware.

C: Für den Decoder einen Tiny über I2C anbinden

mal kurzzeitig geschlossen weil ein crossposting mit Drehimpulsgeber auslesen funktioniert nicht - Deutsch - Arduino Forum

Grüße Uwe