aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-01-17 05:06:52 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-01-17 05:06:52 +0000
commit111ef5570f28f282675da03c58c43bb89f7acbeb (patch)
tree9bdefdf1c3aa15b95dad5b874df9e4696963c31b
parent39866a114de08ed8f42e67126d8699ac0d3e70c3 (diff)
some objects used for generating PWM signals within Pd. These were used with a MIDI->relay board to control the speed of a motor.
svn path=/trunk/externals/hcs/; revision=4431
-rw-r--r--pwm.pd66
-rw-r--r--pwm~-help.pd29
-rw-r--r--pwm~.pd23
3 files changed, 118 insertions, 0 deletions
diff --git a/pwm.pd b/pwm.pd
new file mode 100644
index 0000000..98925a5
--- /dev/null
+++ b/pwm.pd
@@ -0,0 +1,66 @@
+#N canvas 28 81 655 590 10;
+#X msg 331 412 0;
+#X msg 280 413 1;
+#X text 404 362 duty cycle;
+#X obj 307 442 f;
+#X obj 179 31 inlet;
+#X obj 379 32 inlet;
+#X text 219 31 start/stop;
+#X text 422 33 speed (0-1);
+#X obj 349 385 delay;
+#X obj 280 147 select 1;
+#X obj 331 169 bang;
+#X obj 179 106 t f f;
+#X obj 280 233 oneshot;
+#X msg 288 210 clear;
+#X obj 172 333 spigot;
+#X obj 172 291 bang;
+#X obj 515 137 f \$1;
+#X obj 529 225 /;
+#X obj 515 180 t b f;
+#X msg 515 201 1000;
+#X obj 515 109 loadbang;
+#X obj 172 311 delay 100;
+#X obj 379 362 *;
+#X obj 379 89 max 0;
+#X obj 379 67 min 1;
+#X obj 395 337 r \$0-cycle_ms;
+#X obj 529 264 s \$0-cycle_ms;
+#X obj 230 290 r \$0-cycle_ms;
+#X text 27 8 argument = pwm rate in Hz;
+#X obj 515 156 abs;
+#X obj 307 494 outlet;
+#X text 126 533 TODO: needs to have default pwm rate if none is set
+;
+#X connect 0 0 3 0;
+#X connect 1 0 3 0;
+#X connect 1 0 15 0;
+#X connect 3 0 30 0;
+#X connect 4 0 11 0;
+#X connect 5 0 24 0;
+#X connect 8 0 0 0;
+#X connect 9 0 12 0;
+#X connect 9 1 10 0;
+#X connect 10 0 0 0;
+#X connect 10 0 13 0;
+#X connect 11 0 9 0;
+#X connect 11 1 14 1;
+#X connect 12 0 1 0;
+#X connect 12 0 8 0;
+#X connect 13 0 12 0;
+#X connect 14 0 8 0;
+#X connect 14 0 1 0;
+#X connect 15 0 21 0;
+#X connect 16 0 29 0;
+#X connect 17 0 26 0;
+#X connect 18 0 19 0;
+#X connect 18 1 17 1;
+#X connect 19 0 17 0;
+#X connect 20 0 16 0;
+#X connect 21 0 14 0;
+#X connect 22 0 8 1;
+#X connect 23 0 22 0;
+#X connect 24 0 23 0;
+#X connect 25 0 22 1;
+#X connect 27 0 21 1;
+#X connect 29 0 18 0;
diff --git a/pwm~-help.pd b/pwm~-help.pd
new file mode 100644
index 0000000..3872d5a
--- /dev/null
+++ b/pwm~-help.pd
@@ -0,0 +1,29 @@
+#N canvas 218 225 905 389 10;
+#N canvas 0 22 450 300 graph1 0;
+#X array array99 100 float 0;
+#X coords 0 1.1 100 -0.1 200 100 1;
+#X restore 67 250 graph;
+#X obj 92 183 metro 500;
+#X obj 92 158 r metro;
+#X text 344 90 <-- Click to start;
+#X text 233 209 <-- graph the output;
+#X text 311 301 see also:;
+#X obj 76 207 tabwrite~ array99;
+#X obj 255 48 tgl 25 0 empty empty start 0 -6 1 9 -24198 -1 -1 1 1
+;
+#X msg 255 76 \; pd dsp \$1 \; metro \$1;
+#X obj 385 301 pwm;
+#X obj 79 98 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 0 1;
+#X floatatom 34 98 5 0 0 0 - - -;
+#X obj 76 127 pwm~ 4410;
+#X obj 36 11 pwm~;
+#X text 79 10 after an idea from Roman Haefeli;
+#X text 158 126 argument = pwm rate in Hz;
+#X connect 1 0 6 0;
+#X connect 2 0 1 0;
+#X connect 2 0 1 0;
+#X connect 7 0 8 0;
+#X connect 10 0 11 0;
+#X connect 10 0 12 0;
+#X connect 12 0 6 0;
diff --git a/pwm~.pd b/pwm~.pd
new file mode 100644
index 0000000..81ac158
--- /dev/null
+++ b/pwm~.pd
@@ -0,0 +1,23 @@
+#N canvas 451 182 489 527 10;
+#X obj 29 49 inlet;
+#X obj 113 405 outlet~;
+#X obj 113 198 phasor~;
+#X obj 113 172 sig~ \$1;
+#X text 79 10 after an idea from Roman Haefeli;
+#X text 15 10 [pwm~];
+#X obj 366 47 inlet;
+#X obj 113 226 >~;
+#X text 143 229 zexy object;
+#X obj 31 94 t b f;
+#X msg 31 114 1;
+#X obj 45 135 -;
+#X text 77 113 invert so 1 = full power;
+#X connect 0 0 9 0;
+#X connect 2 0 7 0;
+#X connect 3 0 2 0;
+#X connect 6 0 2 1;
+#X connect 7 0 1 0;
+#X connect 9 0 10 0;
+#X connect 9 1 11 1;
+#X connect 10 0 11 0;
+#X connect 11 0 7 1;