aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-03-05 06:48:01 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-03-05 06:48:01 +0000
commit01226f1e1e0db8cdff714999a71fddb218562c45 (patch)
treeb6d34371af5aed94f170e17bb95201da02a70392 /examples
parent9a3ca9f757a699cea97dec772c4b8d446d06ad21 (diff)
some example patches for the existing puredata firmwares, and the start of firmware for getting all inputs into Pd as fast as possible. Some clean-up needed before a real release
svn path=/trunk/externals/hardware/arduino/; revision=4647
Diffstat (limited to 'examples')
-rw-r--r--examples/PD_all_inputs.pd95
-rw-r--r--examples/PD_inputs_to_PD.pd18
-rw-r--r--examples/PD_send_potentiometer.pd36
-rw-r--r--examples/PD_two_potentiometers.pd80
-rw-r--r--examples/Pd_Input/Pd_Input.pde33
5 files changed, 235 insertions, 27 deletions
diff --git a/examples/PD_all_inputs.pd b/examples/PD_all_inputs.pd
new file mode 100644
index 0000000..8f78216
--- /dev/null
+++ b/examples/PD_all_inputs.pd
@@ -0,0 +1,95 @@
+#N canvas 159 48 492 617 10;
+#X obj 346 18 import zexy;
+#X text 112 148 On Mac OS X \, set this to the right value:;
+#X text 5 38 You might need to select another port \, check the Pd
+window to see if it connected successfully:;
+#X msg 136 120 close;
+#X msg 116 165 devicename /dev/tty.usbserial-191;
+#X obj 11 508 nbx 4 20 -1e+37 1e+37 0 0 empty empty ADC0 5 30 1 10
+-3754 -1 -1 508 256;
+#N canvas 162 133 518 368 serin 0;
+#X obj 160 101 cnv 15 15 15 empty \$0-number-canvas 1 4 7 0 14 -233017
+-1 0;
+#X obj 241 251 s \$0-number-canvas;
+#X obj 100 101 hradio 15 1 0 4 empty empty empty 0 -6 0 8 -225271 -1
+-1 0;
+#X obj 101 134 + 1;
+#X obj 100 173 outlet;
+#X obj 101 39 inlet;
+#X msg 241 228 label \$1;
+#X obj 241 206 makefilename %d;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 3 0 7 0;
+#X connect 5 0 2 0;
+#X connect 6 0 1 0;
+#X connect 7 0 6 0;
+#X coords 0 -1 1 1 76 17 1 100 100;
+#X restore 77 71 pd serin;
+#X msg 77 119 open \$1;
+#X text 4 -3 This patch works with the example Arduino firmware of
+the same name.;
+#X text 9 552 CAUTION! Watch out if you connect your potentiometer
+without an extra resistor \, when you turn it all the way up \, the
+full voltage and current will go to the input. This could fry your
+board!;
+#X obj 79 357 +;
+#X obj 78 259 trigger float bang;
+#X obj 95 318 float;
+#X obj 95 337 * 10;
+#X obj 176 345 float;
+#X msg 196 290 0;
+#X text 250 459 ASCII for A B C D E F;
+#X obj 77 235 - 48;
+#X obj 79 460 route 65 66 67 68 69 70;
+#X obj 79 378 trigger bang float;
+#X obj 79 417 float;
+#X obj 247 386 float;
+#X obj 79 440 pack float float;
+#X obj 61 508 nbx 4 20 -1e+37 1e+37 0 0 empty empty ADC1 5 30 1 10
+-3754 -1 -1 0 256;
+#X obj 111 508 nbx 4 20 -1e+37 1e+37 0 0 empty empty ADC2 5 30 1 10
+-3754 -1 -1 10 256;
+#X obj 161 508 nbx 4 20 -1e+37 1e+37 0 0 empty empty ADC3 5 30 1 10
+-3754 -1 -1 98 256;
+#X obj 211 508 nbx 4 20 -1e+37 1e+37 0 0 empty empty ADC4 5 30 1 10
+-3754 -1 -1 158 256;
+#X obj 261 508 nbx 4 20 -1e+37 1e+37 0 0 empty empty ADC5 5 30 1 10
+-3754 -1 -1 623 256;
+#X obj 320 511 print ERRANT_VALUE;
+#X obj 247 250 float;
+#X obj 77 211 moses 58;
+#X text 84 88 (sometimes it takes up to 10 seconds to close the serial
+port \, if things are running fast);
+#X text 181 121 <-- close before uploading a new firmware!;
+#X obj 77 188 comport 1 19200;
+#X connect 3 0 33 0;
+#X connect 4 0 33 0;
+#X connect 6 0 7 0;
+#X connect 7 0 33 0;
+#X connect 10 0 14 0;
+#X connect 10 0 19 0;
+#X connect 11 0 10 0;
+#X connect 11 1 12 0;
+#X connect 12 0 13 0;
+#X connect 13 0 10 1;
+#X connect 14 0 12 1;
+#X connect 15 0 12 1;
+#X connect 17 0 11 0;
+#X connect 18 0 5 0;
+#X connect 18 1 23 0;
+#X connect 18 2 24 0;
+#X connect 18 3 25 0;
+#X connect 18 4 26 0;
+#X connect 18 5 27 0;
+#X connect 18 6 28 0;
+#X connect 19 0 20 0;
+#X connect 19 1 22 1;
+#X connect 20 0 22 0;
+#X connect 21 0 20 1;
+#X connect 22 0 18 0;
+#X connect 29 0 15 0;
+#X connect 29 0 21 0;
+#X connect 30 0 17 0;
+#X connect 30 1 29 0;
+#X connect 33 0 30 0;
diff --git a/examples/PD_inputs_to_PD.pd b/examples/PD_inputs_to_PD.pd
index 5fd0be8..14a0c33 100644
--- a/examples/PD_inputs_to_PD.pd
+++ b/examples/PD_inputs_to_PD.pd
@@ -1,4 +1,4 @@
-#N canvas 583 37 658 481 10;
+#N canvas 583 37 662 485 10;
#X obj 29 56 r pushButton2;
#X obj 29 76 nbx 3 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 14
-241291 -1 -1 0 256;
@@ -26,7 +26,6 @@
#X obj 369 129 nbx 6 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 14
-3754 -1 -1 0 256;
#X obj 369 109 r potentioMeter2;
-#X msg 246 316 devicename /dev/tty.usbserial-181;
#X text 242 298 On Mac OS X \, set this to the right value:;
#X msg 192 255 open \$1;
#X obj 192 358 comport 1 9600;
@@ -65,6 +64,7 @@ the same name.;
#X coords 0 -1 1 1 76 17 1 100 100;
#X restore 192 232 pd serin;
#X text 273 233 serial port #;
+#X msg 246 316 devicename /dev/tty.usbserial-191;
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 4 0 5 0;
@@ -74,10 +74,10 @@ the same name.;
#X connect 13 0 12 0;
#X connect 15 0 14 0;
#X connect 17 0 16 0;
-#X connect 18 0 21 0;
-#X connect 20 0 21 0;
-#X connect 21 0 29 0;
-#X connect 28 0 21 0;
-#X connect 29 0 32 0;
-#X connect 29 1 31 0;
-#X connect 34 0 20 0;
+#X connect 19 0 20 0;
+#X connect 20 0 28 0;
+#X connect 27 0 20 0;
+#X connect 28 0 31 0;
+#X connect 28 1 30 0;
+#X connect 33 0 19 0;
+#X connect 35 0 20 0;
diff --git a/examples/PD_send_potentiometer.pd b/examples/PD_send_potentiometer.pd
index bde76f5..c869645 100644
--- a/examples/PD_send_potentiometer.pd
+++ b/examples/PD_send_potentiometer.pd
@@ -1,16 +1,12 @@
-#N canvas 66 362 494 354 10;
-#X text 153 122 On Mac OS X \, set this to the right value:;
-#X obj 103 182 comport 1 9600;
-#X text 30 11 You might need to select another port \, check the Pd
+#N canvas 66 362 498 358 10;
+#X text 151 136 On Mac OS X \, set this to the right value:;
+#X obj 101 196 comport 1 9600;
+#X text 28 25 You might need to select another port \, check the Pd
window to see if it connected successfully:;
-#X msg 163 87 close;
-#X msg 157 139 devicename /dev/tty.usbserial-191;
-#X obj 102 215 nbx 6 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 14
--3754 -1 -1 79 256;
-#X text 36 252 CAUTION! Watch out if you connect your potentiometer
-without an extra resistor \, when you turn it all the way up \, the
-full voltage and currrent will go to the input. This could kill your
-board!;
+#X msg 161 101 close;
+#X msg 155 153 devicename /dev/tty.usbserial-191;
+#X obj 100 229 nbx 6 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 14
+-3754 -1 -1 13 256;
#N canvas 162 133 518 368 serin 0;
#X obj 160 101 cnv 15 15 15 empty \$0-number-canvas 1 4 7 0 14 -233017
-1 0;
@@ -29,13 +25,17 @@ board!;
#X connect 6 0 1 0;
#X connect 7 0 6 0;
#X coords 0 -1 1 1 76 17 1 100 100;
-#X restore 103 61 pd serin;
-#X msg 103 86 open \$1;
-#X text 184 62 serial port #;
-#X text 30 -20 This patch works with the example Arduino firmware of
+#X restore 101 75 pd serin;
+#X msg 101 100 open \$1;
+#X text 182 76 serial port #;
+#X text 28 -6 This patch works with the example Arduino firmware of
the same name.;
+#X text 34 266 CAUTION! Watch out if you connect your potentiometer
+without an extra resistor \, when you turn it all the way up \, the
+full voltage and current will go to the input. This could kill your
+board!;
#X connect 1 0 5 0;
#X connect 3 0 1 0;
#X connect 4 0 1 0;
-#X connect 7 0 8 0;
-#X connect 8 0 1 0;
+#X connect 6 0 7 0;
+#X connect 7 0 1 0;
diff --git a/examples/PD_two_potentiometers.pd b/examples/PD_two_potentiometers.pd
new file mode 100644
index 0000000..9f56583
--- /dev/null
+++ b/examples/PD_two_potentiometers.pd
@@ -0,0 +1,80 @@
+#N canvas 327 35 530 629 10;
+#X obj 420 2 import zexy;
+#X text 127 139 On Mac OS X \, set this to the right value:;
+#X obj 77 195 comport 1 9600;
+#X text 5 42 You might need to select another port \, check the Pd
+window to see if it connected successfully:;
+#X msg 137 104 close;
+#X msg 131 156 devicename /dev/tty.usbserial-191;
+#X obj 111 506 nbx 4 20 -1e+37 1e+37 0 0 empty empty Analog_in_0 -15
+30 1 14 -3754 -1 -1 0 256;
+#N canvas 162 133 518 368 serin 0;
+#X obj 160 101 cnv 15 15 15 empty \$0-number-canvas 1 4 7 0 14 -233017
+-1 0;
+#X obj 241 251 s \$0-number-canvas;
+#X obj 100 101 hradio 15 1 0 4 empty empty empty 0 -6 0 8 -225271 -1
+-1 0;
+#X obj 101 134 + 1;
+#X obj 100 173 outlet;
+#X obj 101 39 inlet;
+#X msg 241 228 label \$1;
+#X obj 241 206 makefilename %d;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 3 0 7 0;
+#X connect 5 0 2 0;
+#X connect 6 0 1 0;
+#X connect 7 0 6 0;
+#X coords 0 -1 1 1 76 17 1 100 100;
+#X restore 77 78 pd serin;
+#X msg 77 103 open \$1;
+#X text 158 79 serial port #;
+#X text 4 -3 This patch works with the example Arduino firmware of
+the same name.;
+#X text 6 550 CAUTION! Watch out if you connect your potentiometer
+without an extra resistor \, when you turn it all the way up \, the
+full voltage and current will go to the input. This could fry your
+board!;
+#X obj 156 246 makefilename %c;
+#X obj 77 225 select 13 10;
+#X text 266 246 <-- convert integer to ASCII;
+#X obj 223 424 +;
+#X obj 193 470 float;
+#X obj 221 315 trigger float bang;
+#X obj 239 385 float;
+#X obj 239 404 * 10;
+#X obj 221 289 symbol2list;
+#X obj 320 412 float;
+#X msg 164 337 0;
+#X obj 150 470 float;
+#X text 197 339 <-- reset for the next pot reading;
+#X text 303 285 <-- converts the ASCII digit;
+#X text 332 297 symbol to a float;
+#X text 169 225 <-- filter out newline characters;
+#X obj 156 267 select B A;
+#X obj 209 506 nbx 4 20 -1e+37 1e+37 0 0 empty empty Analog_in_1 -15
+30 1 14 -3754 -1 -1 0 256;
+#X connect 2 0 13 0;
+#X connect 4 0 2 0;
+#X connect 5 0 2 0;
+#X connect 7 0 8 0;
+#X connect 8 0 2 0;
+#X connect 12 0 28 0;
+#X connect 13 2 12 0;
+#X connect 15 0 16 1;
+#X connect 15 0 21 0;
+#X connect 15 0 23 1;
+#X connect 16 0 29 0;
+#X connect 17 0 15 0;
+#X connect 17 1 18 0;
+#X connect 18 0 19 0;
+#X connect 19 0 15 1;
+#X connect 20 0 17 0;
+#X connect 21 0 18 1;
+#X connect 22 0 18 1;
+#X connect 23 0 6 0;
+#X connect 28 0 22 0;
+#X connect 28 0 23 0;
+#X connect 28 1 22 0;
+#X connect 28 1 16 0;
+#X connect 28 2 20 0;
diff --git a/examples/Pd_Input/Pd_Input.pde b/examples/Pd_Input/Pd_Input.pde
new file mode 100644
index 0000000..d5dd5e7
--- /dev/null
+++ b/examples/Pd_Input/Pd_Input.pde
@@ -0,0 +1,33 @@
+/* Pd_Input
+ * ------------------
+ *
+ * This program reads all of the Analog inputs
+ * and sends the data to the computer as fast as
+ * possible. It was designed to work with the Pd
+ * patch of the same name in:
+ * Help -> Browser -> examples -> hardware
+ *
+ * (cleft) 2006 Hans-Christoph Steiner
+ * @author: Hans-Christoph Steiner
+ * @date: 2006-03-04
+ * @location: Polytechnic University, Brooklyn, New York, USA
+ */
+
+/*
+ * CAUTION!! Do not turn on the Serial Monitor, it could freeze
+ * your computer with this firmware running! It outputs data
+ * without a delay() so its very fast.
+ */
+
+int potPin = 0;
+void setup() {
+ beginSerial(19200);
+}
+
+void loop() {
+ printByte(potPin + 65); // add 65 to get ASCII chars starting with A
+ printInteger(analogRead(potPin));
+ potPin = potPin + 1;
+ if (potPin > 5)
+ potPin = 0;
+}