I am working on a project involving a reed switch sensor attached to a motor. I’d like to be able to count the rotation of the motor. Can someone share a micropython script for ESP8266/ESP32 to do this? Thanks in advance.
I don’t know exactly the setup of your project, but I guess the reed switch activates when the motor completes a turn?
Is that it?
If not, can you better explain your project so that I can help you better?
Yes. I’d like to be able to count the number of times the magnet on the motor triggers the reed switch sensor every time it passes it when it completes 1 rotation. It looks like there is an API but I do not see anything on micropython. http://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/pcnt.html#pcnt-api-configuration
I found this: https://micropython-tve.readthedocs.io/en/counter/library/machine.Counter.html
See if you can implement.