so decided play with CSound today 🙂
(this follows on a bit from https://forum.bela.io/d/562-salt-and-supercollider )
so I could get the sound working nicely, and so switched to playing with leds and switches, and like supercollider,
I getting a small issue
<CsoundSynthesizer>
<CsOptions>
-m0d
</CsOptions>
<CsInstruments>
ksmps = 8
nchnls = 2
0dbfs = 1
instr 1
aSine = poscil(0.5, 250)
kFreq = 48000/32
kAmp = 0
kDummy = 0
aPW vco2 1,kFreq, 2, 0.5
digiOutBela aPW, 7
kSwitch digiInBela 6
if (kSwitch > 0.5 ) then
digiOutBela 0, 2
kAmp = 1
else
kDummy digiInBela 2
kAmp = 0
endif
aOut = aSine * kAmp
outs aOut, aOut
endin
</CsInstruments>
<CsScore>
i1 0 86400
</CsScore>
</CsoundSynthesizer>
so basically here we have PWM on pin 7 ,
and input on T1/Pin6 and led 1 pin 2
but again there is some kind of interaction going on which is a bit unclear
so...
if no PWM is present on pin7, then taking led high = led off, and led low = led red!
ok, perhaps always a pwm, should be present
so turning on pwm (as in above code) (pw=0.5, so square)
now initially led is OFF, ok this is what we expect.
cool, press t1, led is RED, cool this is also what we expect! (I thi
but now released t1, so kSwitch=0 (confirmed by using kAmp) , and the led turns to tello
it should go to off, since we are doing a read on pin2!
for completeness, if I change digiOutBela 0, 2 to digiOutBela 1, 2, then correctly, the led goes to yellow, but again, does not return to off.
thoughts?
where is the source code for the Bela opcodes?