Closed crbyxwpzfl closed 1 year ago
You can try the raw command directly like that:
cmd = bytearray(64)
cmd[0] = 0x51
while True:
mcp.dev.write(cmd)
value = mcp.dev.read(64)
Since it communicates through HID in 64 byte chunks I assume it won't become lightning-fast though. Also when I read the datasheet you linked to I see that you need to measure pulse widths. If you want precise timings you should rather stick a microcontroller in between the MCP and your chip.
okok I will try the raw command method. Otherwise I try an other sensor which has I2C or use a microcontroller in between like you suggested. Thank you very much!
Hi, this is a general question so please close this if this is unrelated to your driver.
tl;dr
I timed
mcp.gpio_read_value(1)
and found it to be around 0.002s This seems slow to me compared to a microcontroller or raspberry pi. Is it possible to read the value of the pin quicker? Again I am very grateful for any tips or Info.full story
I just tried to run a ultrasonic-distance-sensor (HC-SR04) with the mcp2221. I expected the same code form my raspberry to work with the mcp2221.
But the script gave very wired readings.
Since the Sensor Requires quite fast GPIO operations I timed
mcp.gpio_read_value(1)
viathis gave this output
Perhaps this is the reason why the sensor script does not work spec sheet of HC-SR04