mngyuan idn't quite understand what you meant, I read the link but wasn't sure I fully understood.
I meant that those two pins are used by Bela's digital I/O, so if you try to run this alongside the Bela audio thread (in a different thread, as mentioned above), you will not be able to use these pins unless you disable Bela's digitals channels, which should explain why:
I'm just getting 0 as my readings inside render in my render.cpp
Anyhow, given how you are on BelaMini, it's fairly easy to move to other pins that Bela wont' interfere with: pick two pins from here that don't have the Dx or the green rectangle overlay. For instance, P2.03 (gpio 23) and P2.05 (gpio 30). Then run on the console at the bottom of the IDE:
config-pin P2.03 gpio
config-pin P2.05 gpio
(you'll have to do this after every reboot).
if I disable digital in the IDE settings a red LED comes on.
Not sure why the red LED would turn on (it doesn't for me) ... does the audio still work? Are you getting dropouts?
mngyuan I'm also realizing my HX711 board reads at 10 samples/second, which I think is too slow for realtime audio response. I feel like trying to read in render should be causing underruns with my buffer size set to 16 frames but it's not for some reason.
Well that depends from your code ... if you simply call
read_cnt() from within
render(), it shouldn't cause dropouts. The fact that the sensor outputs new data 10 times per second doesn't affect the speed at which you are trying to read it.
mngyuan ow do I read HX711 using the method in hx711.cpp while outputting audio with Bela? or is that not possible?
The easiest way to reuse the code you currently have (if running it within
render() does not work), is to do that in a separate thread. Bela provides
AuxiliaryTasks (which are a light wrapper upon a "regular" pthread). Some examples that use them can serve as a source of inspiration:
mostly anything in the