Skip to content

Sampling Rate for ADC is extremely low #78

@pshanesmith

Description

@pshanesmith

As currently written, it appears you can only do about 93 SPS. It looks like if there is a shorter delay introduced on analog_read, it drastically increases the sampling rate and it seems to be running stable.

`
def analog_read(self, pin):
"""Read the value of an analog pin by number"""
buf = bytearray(2)
if pin not in self.pin_mapping.analog_pins:
raise ValueError("Invalid ADC pin")

    self.read(
        _ADC_BASE,
        _ADC_CHANNEL_OFFSET + self.pin_mapping.analog_pins.index(pin),
        buf,
        .0001,
    )
    ret = struct.unpack(">H", buf)[0]
    time.sleep(0.001)
    return ret

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions