Can anybody explain to me how the Pulse Counter Library works in lua? I have watched John Lauers video on it and I am still not clear on how it works.
I want to be able to count pulses and call a method when the counter reaches a specific value.
Yes I was able to install the necessary firmware(I used the cloud based solution) and I have tested some of the examples like the ones with the button GPIO. Im having a difficult time understanding how the pulsecnt increments.
I have been testing it with a motor controller and its producing output when a triggering event occurs, but the count never gets higher than 5 even though the high limit(HLim) is set to 32227. the counter fluctuates weirdly between 0,1,2,3,4 or 5.
Yes I am using the sample code. Noise seems like a reasonable cause but ill have to test and see.
Attached is a snippet of the output I was getting in the console.
– Set clock cycles for filter. Any pulses lasting shorter than
– this will be ignored when the filter is enabled. So, pulse
– needs to be high or low for longer than this filter clock
– cycle. Clock is 80Mhz APB clock, so one cycle is
– 1000/80,000,000 = 0.0000125 ms. 1023 cycles = 0.0127875 ms
– so not much of a debounce for manual push buttons.
pcnt:setFilter(1023)