PulseIn Not Updating Values

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
lawrenceyy
 
Posts: 108
Joined: Thu May 07, 2015 12:32 pm

PulseIn Not Updating Values

Post by lawrenceyy »

I have isolated my problem in the small example below. I am reading PWM from an RC receiver. When sleepTime is 1 second, my PulseIn instance stops updating values after 5-20 seconds. When the sleepTime is .1 seconds, it continually updates values. I expect "2" to be printed every time, but when sleepTime is 1 second, it eventually starts printing "0", and never returning to "2".

Code: Select all

import time
import board
import pulseio

sleepTime = 1
pulses = pulseio.PulseIn(board.D11, 2, False)

while True:
    print('')
    time.sleep(sleepTime)
    print(len(pulses))
    pulses.clear()

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: PulseIn Not Updating Values

Post by tannewt »

What board are you using?

User avatar
lawrenceyy
 
Posts: 108
Joined: Thu May 07, 2015 12:32 pm

Re: PulseIn Not Updating Values

Post by lawrenceyy »

I am using an M4 Express.

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: PulseIn Not Updating Values

Post by tannewt »

Please file an issue. This sounds like a bug: https://github.com/adafruit/circuitpyth ... new/choose

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”