Read gpio from python

I’m trying to implement a basic homing function for my corexy design powered by odrive.

I know there is a hardware issue with with GND on odrive 3.3 and below that affects my 3.2 and i would rather not try to fix it for now.

Since there is some motor logic to move on XY (compared to motor axis) + I am not willing to put homing switches on the gantry (i will instead rely on contactless (magnets) switches carefully positioned so that I can do the homing on Y, and then on X. Connect some switches to GPIO (and maybe put some resistors as well)
I was thinking about

  1. move Y in the upper position for say 0.5 mm
  2. read gpio from usb
  3. repeat until i see contact

However, reading from the USB dump of parameters, it does not seem that GPIO are exposed (see dump below)

Can I read such gpio values with USB or should I do this with a separate card?


[edit: removed the dump of parameters, it was too long to read]

Reading of general GPIO will be available with Firmware v0.4.0, which should be ready in a few weeks.

ok. thanks. i used an arduino for now

Hi guys,

Just wondering what the progress on this is. I don’t see where I’d be able to get to them yet through the ODrive tool

Hm yes I think we forgot to expose them on the protocol. But I think you may be able to get the pin states by using get_adc_voltage(gpio: int).
Let me know if that works.

1 Like

This doesn’t work on non analog pins, as the function explicitly returns NaN in that case.