OVMS3-idf/examples/16_pcnt/README.md

773 B

Example: pcnt

This example uses the pulse counter module (PCNT) to count the rising edges of pulses generated by the LED Controller module (LEDC).

By default GPIO18 is used as output pin, GPIO4 is used as pulse input pin and GPIO5 is used as control input pin. This configuration (pin numbers, etc.) can be modified in top of the main/pcnt_test.c file.

  • Open serial port to view the message printed on your screen
  • To do this test, you should connect GPIO18 with GPIO4
  • GPIO5 is the control signal, you can leave it floating with internal pulled up, or connect it to ground. HIGH = Count increases, LOW = count decreases.
  • An interrupt is configured to trigger when the count reaches threshold values.
  • The counter will reset when it reaches the limit values.