I easily arranged a dc motor joystick-controlled by reading analog value from joystick & sending it to pwm input of a L293 driver. (plus a couple of digital output for direction). Now, since the motor has an Hall-sensor 4pulse/round TTL output, I'd like to read the pulses to realize a positioning system.
I'm a bit confused about how to conceive the sketch: what's the best way to count a pulse on a Arduino pin, once confiugured as INPUT? Is there a library or wiring command to supply the needed updating&increment lines?
Anyway, I suppose that the right way is - once the position variable has been filled wth the pulse count result, it has to be compared with the command value, - in this case a precision linear potentiometer, that gives to an analogRead pin a 0 trough 1024 range; then passed in a if-else structure.
Does anyone have help or suggestions?
Thanks,
Super16