Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger (digital) inputs? #5

Open
csik opened this issue Oct 1, 2019 · 1 comment
Open

Trigger (digital) inputs? #5

csik opened this issue Oct 1, 2019 · 1 comment

Comments

@csik
Copy link

csik commented Oct 1, 2019

I'm new to pyo and the pyo-bela implementation, but I don't see any functionality for digital io (triggers) in the current pyo-bela code. If I'm not missing anything, I'm wondering if there is any plan to add this? I'm currently learning pyo to use with a Bela pepper.

It seems that a seamless approach would be to associate a digital input with a Trig, so that a rising voltage is treated just as any other output from Trig.play() would be. Similarly a trigger output might be able to fire on an event as would a Trig or Metro. I guess I can imagine how these could be hacked using existing functions, but also that this would be more cpu intensive. I guess this implementation would mean using pin interrupts under the BBB hood, unless there's an event loop already polling for this constantly.

Am I missing something altogether? Thanks.

@csik
Copy link
Author

csik commented Oct 11, 2019

This code in render.cpp seems to be able to alert a Sig() object to a changing pin:
bool pin12 = 0;

if (digitalRead(context, 0, 12) != pin12){
pin12 = !pin12;
pyo.value("pin_12", pin12);
}

This is a quick way of getting pin values into the python environment, but I suspect a proper implementation would:

  1. allow for in-python setting of pin directions (is it input or output?) and, for outputs, set them. This is currently a C->python direction, and we'd need python->C to set pins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant