Hello all,
I've not had much luck figuring out how to execute the basic concept of 'do/while' in PD.
Basically, I want to create a MIDI CC oscillator that cycles up and down between 0-127 (ping-pong) while a particular condition is met. The condition is a number that I'm sending over serial from Arduino that signifies a composition level, (level 1, 2, 3, 4, 5, etc). This number is then routed using a Route object into different branches which bang and send out MIDI CC data.
So far, everything is working in terms of routing and the general program works. What I don't get is how to 'cycle' something in PD. Here's what this particular section looks like, but it uses a bang right now, so only is working manually:
(route 1 2 3 4, etc)
(1 is the number that routes to the following bang)
BANG
TOGGLE
(route 1 0)
/ \
(0, 127 6000) (127, 0 6000)
/ /
(line)
/
(ctlout 5 15)
So, basically, I want this MIDI 'Oscillator' to ping-pong back and forth while the condition is met that the program is on 'level 1'.
I've been having success learning PD on my own, but am stuck on this part, and would really appreciate it if anyone can point me towards a concept or hint that might send me in the right direction.
Thanks in advance!
EDIT: I neglected to post the patch before.
http://www.pdpatchrepo.info/hurleur/programmController_v01.pd