Hi, I just started working on a drum machine in supercollider on the bela with the pepper board.
So far things are going well if a bit slow. I can trigger synths using the digital inputs, but I'm having some problems figuring out the pins on the board and turning the LEDs on.
Firstly, the LEDs are working in the sample PD patches, so the bar is soldered on the right way around 🙂
I've updated the bela image to the latest version and updated the IDE as well.
I've tried DigitalOut(n, 1) on all pins from 0 up to 50 (in batches of 10), but no lights.
These are the pin numbers I gleaned from the lilmonsta PD patch:
~leds = [17, 18, 21, 13, 14, 11, 12, 15, 16, 19];
But they also don't help. I'm wondering if I'm doing something entirely wrong?
I'm able to get everything else working pretty well, so I believe I understand how the code works more or less.
Looked around all the documentation and forum posts, but can't find anything on this particular topic.
Another thing that I'm wondering about is if it is possible to use the four first analog inputs to read triggers reliably? I can get them to play synths on trigger in, set the threshold to 0.2 to be sure and it's giving 0.5023123 on trigger in occasionally, but not every time. The analog inputs also fluctuate a fair amount on the lower decimal end, but I guess that's pretty normal.
Here is an example of the code I am using to try to turn on the leds on button presses. I have verified that the buttons are working and that the if/else statement is executing correctly. The only thing I can't check properly is the DigitalOut():
~modes = 9;
~mode = 0;
~leds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// ~leds = [17, 18, 21, 13, 14, 11, 12, 15, 16, 19];
~buttonMonitor2 = {
var d14 = DigitalIn.kr(14);
SendReply.kr(Changed.kr(d14), '/buttonMonitor2', [d14]);
}.play;
~btn2 = 0;
OSCdef('listenToButton2', {
arg msg;
~btn2 = msg[3].asInteger;
if (~btn2 == 1, {
~mode = ~mode+1;
if (~mode > ~modes, {
~mode = 0;
});
~leds.do({ arg led, i;
if ({i == ~mode}.value, {
led.postln;
DigitalOut.kr(~leds[~mode], 1);
}, {
DigitalOut.kr(~leds[~mode], 0);
});
});
});
}, '/buttonMonitor2');