├── 13bug └── 13bug.ino ├── README.md ├── serial_print └── serial_print.ino ├── float_string_bang └── float_string_bang.ino ├── serial_write └── serial_write.ino ├── serial_write-help.pd ├── serial_print-help.pd ├── serial_print13-help.pd ├── LICENSE ├── serial_write.pd ├── serial_print.pd └── serial_print13.pd /13bug/13bug.ino: -------------------------------------------------------------------------------- 1 | void setup() { 2 | Serial.begin(9600); 3 | } 4 | 5 | void loop() { 6 | Serial.write(13); 7 | delay(1000); 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino_Pd 2 | 3 | Arduino_Pd 4 | 5 | This repository is a set of Pd abstractions (both vanilla and extended) and Arduino code that facilitates the communication between the two platforms. 6 | 7 | `[serial_print]` works with the `Serial.print()` and `Serial.println()` functions of the Arduino. 8 | 9 | `[serial_write]` works with the `Serial.write()` function of the Arduino. 10 | 11 | Check their help patches and Arduino code for more information. 12 | 13 | `[serial_print13]` is a version of `[serial_print]` for systems that can't get the number 13 passed from an Arduino to Pd. To test if this is the one you need, load the 13bug.ino sketch to your Arduino, then in Pd, connect `[comport]` to `[print]`. If Pd prints 13, you don't need this version, but it it prints 10, then use this instaed of `[serial_print]`. 14 | 15 | Written by Alexandros Drymonitis 16 | 17 | 18 | 19 | Update December 2023: removed all Pd-extended versions as Pd-extended has not been developed or supported for 10 years 20 | 21 | Update December 2015: enabled sending lists including symbols under one tag 22 | 23 | Update December 2015: corrected the issue with sending a bang while there is data saved in the abstraction 24 | 25 | Update December 2015: enabled the word "float" to be used as a tag in "serial_print_extended" (although it's probably not a good idea to use this word in Pd...) 26 | -------------------------------------------------------------------------------- /serial_print/serial_print.ino: -------------------------------------------------------------------------------- 1 | /* Code that works with the [serial_print] Pd abstraction 2 | * The only values you need to change if your circuit uses more or less 3 | * analog or digital pins are the first two constants, 4 | * numAnalogPins, and numDigitalPins. 5 | * 6 | * Analog pins you use must start from A0, and increment by 1. 7 | * Digital pins you use must start from D2, and increment by 1. 8 | * 9 | * This code simply reads analog and digital pins, you can't use it 10 | * with sensors like an ultra-sonic sensor, because they demand built-it functions 11 | * in order to work. 12 | * 13 | * This code is in the public domain 14 | * written by Alexandros Drymonits 15 | */ 16 | 17 | // analog values array size, must be constant 18 | const int numAnalogPins = 3; 19 | // digital_values array size, must be constant 20 | const int numDigitalPins = 3; 21 | 22 | // create an array to store the values of the potentiometers 23 | int analogValues[numAnalogPins]; 24 | // create an array to store the values of the push-buttons 25 | int digitalValues[numDigitalPins]; 26 | 27 | void setup() { 28 | for(int i = 0; i < numDigitalPins; i++){ 29 | pinMode((i + 2), INPUT_PULLUP); 30 | } 31 | Serial.begin(9600); 32 | } 33 | 34 | void loop() { 35 | for(int i = 0; i < numAnalogPins; i++) analogValues[i] = analogRead(i); 36 | 37 | for(int i = 0; i < numDigitalPins; i++) digitalValues[i] = !digitalRead(i + 2); 38 | 39 | Serial.print("Analog_values:"); 40 | for(int i = 0; i < numAnalogPins; i++){ 41 | Serial.print(" "); 42 | Serial.print(analogValues[i]); 43 | } 44 | Serial.println(); 45 | 46 | Serial.print("Digital_values:"); 47 | for(int i = 0; i < numDigitalPins; i++){ 48 | Serial.print(" "); 49 | Serial.print(digitalValues[i]); 50 | } 51 | Serial.println(); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /float_string_bang/float_string_bang.ino: -------------------------------------------------------------------------------- 1 | #define MAX_RAND 10000 2 | 3 | String strings[3] = { "one_string", "another_string", "last_string" }; 4 | int string_counter = 0; 5 | 6 | String list_strings[3] = { "a_string_in_a_list", "another_list_string", "last_list_string" }; 7 | int list_str_cnt = 0; 8 | 9 | float a_float, another_float, negative_float; 10 | int an_int; 11 | 12 | void setup() { 13 | Serial.begin(9600); 14 | } 15 | 16 | void loop() { 17 | if(Serial.available()){ 18 | byte in_byte = Serial.read(); 19 | 20 | switch(in_byte){ 21 | case 0: 22 | a_float = (float)random(MAX_RAND) / (float)MAX_RAND; 23 | Serial.print("a_float\t"); 24 | // print a float with five digits 25 | Serial.println(a_float, 5); 26 | break; 27 | 28 | case 1: 29 | Serial.print("a_string\t"); 30 | Serial.println(strings[string_counter]); 31 | string_counter++; 32 | if(string_counter >= 3) string_counter = 0; 33 | break; 34 | 35 | case 2: 36 | Serial.print("a_bang\t"); 37 | Serial.println("bang"); 38 | break; 39 | 40 | case 3: 41 | negative_float = ((float)random(MAX_RAND) / (float)MAX_RAND) * -1.0; 42 | Serial.print("negative_float\t"); 43 | Serial.println(negative_float, 5); 44 | break; 45 | 46 | case 4: 47 | an_int = random(MAX_RAND); 48 | another_float = (float)random(MAX_RAND) / (float)MAX_RAND; 49 | Serial.print("mixed_list\t"); 50 | Serial.print(list_strings[list_str_cnt]); Serial.print("\t"); 51 | Serial.print(another_float, 5); Serial.print("\t"); 52 | Serial.print(an_int); Serial.print("\t"); 53 | // the bang can't be included in a list in Pd, so it will be output last 54 | // no matter where it's placed in the Arduino code 55 | Serial.println("bang"); 56 | list_str_cnt++; 57 | if(list_str_cnt >= 3) list_str_cnt = 0; 58 | break; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /serial_write/serial_write.ino: -------------------------------------------------------------------------------- 1 | /* Code that works with the [serial_write] Pd abstraction 2 | * The only values you need to change if your circuit uses more or less 3 | * analog or digital pins are the first two constants, 4 | * num_of_analog_pins, and num_of_digital_pins. 5 | * 6 | * Analog pins you use must start from A0, and increment by 1. 7 | * Digital pins you use must start from D2, and increment by 1. 8 | * 9 | * This code simply reads analog and digital pins, you can't use it 10 | * with sensors like an ultra-sonic sensor, cause they demand built-it functions 11 | * in order to work. 12 | * 13 | * This code is in the public domain 14 | * written by Alexandros Drymonits 15 | */ 16 | 17 | // analog values array size, must be constant 18 | const int numAnalogPins = 3; 19 | // digital values array size, must be constant 20 | const int numDigitalPins = 3; 21 | 22 | // assemble number of bytes we need 23 | // analog values are being split in two, so their number times 2 24 | // and we need a unique byte to denote the beginning of the data stream 25 | const int numBytes = (numAnalogPins * 2) + numDigitalPins + 1; 26 | 27 | // array to store all bytes 28 | byte transferArray[numBytes]; 29 | 30 | void setup() { 31 | for(int i = 0; i < numDigitalPins; i++) pinMode((i + 2), INPUT_PULLUP); 32 | 33 | Serial.begin(57600); 34 | } 35 | 36 | void loop() { 37 | transferArray[0] = 0xc0; // denote beginning of data 38 | int index = 1; // index offset 39 | 40 | // store the analog values to the array 41 | for(int i = 0; i < numAnalogPins; i++){ 42 | int analogVal = analogRead(i); 43 | // split analog values so they can retain their 10-bit resolution 44 | transferArray[index++] = analogVal & 0x007f; 45 | transferArray[index++] = analogVal >> 7; 46 | } 47 | 48 | // store the digital values to the array 49 | for(int i = 0; i < numDigitalPins; i++) 50 | transferArray[index++] = !digitalRead(i + 2); 51 | 52 | // transfer bytes over serial 53 | Serial.write(transferArray, numBytes); 54 | } 55 | -------------------------------------------------------------------------------- /serial_write-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 413 180 1128 637 10; 2 | #X msg 54 407 close; 3 | #X obj 37 14 cnv 15 400 40 empty empty empty 20 12 0 14 #c0d828 #404040 0; 4 | #X text 866 524 Written by Alexandros Drymonitis; 5 | #X msg 43 380 devices; 6 | #X floatatom 103 388 5 0 0 0 - - - 0; 7 | #X msg 103 407 open \$1; 8 | #X text 610 242 Inlets:; 9 | #X text 650 259 1st: bytes from [comport]; 10 | #X text 610 326 Outlets:; 11 | #X text 49 19 [serial_write]: abstraction that works with Arduinos' Serial.write() function (with the use of [comport]); 12 | #X text 40 78 [serial_write] is a vanilla abstraction that works with [comport] and Arduino's Serial.write() function.; 13 | #X obj 43 512 serial_write analog 3 digital 3; 14 | #X obj 43 535 unpack f f f, f 14; 15 | #X obj 226 535 unpack f f f; 16 | #X obj 226 558 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 17 | #X obj 260 558 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 18 | #X obj 295 558 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 19 | #X floatatom 43 559 5 0 0 0 - - - 0; 20 | #X floatatom 83 559 5 0 0 0 - - - 0; 21 | #X floatatom 124 559 5 0 0 0 - - - 0; 22 | #X text 40 250 This help patch works with the serial_write.ino sketch. Check it for more information.; 23 | #X text 585 26 Arguments:; 24 | #X text 644 47 1st (obligatory): type of pins you are reading (analog or digital); 25 | #X text 647 75 2nd (obligatory): number of pins of the type specified by the first argument; 26 | #X text 648 107 3rd (optional): type of pins you are reading (if first argument is "analog" \, then this is "digital" \, and vice versa); 27 | #X text 647 151 4th (optional. if third argument provided \, then this is obligatory as well): number of pins of the type specified by the third argument; 28 | #X text 650 278 2nd: message to set number of pins with type; 29 | #X text 654 344 1st: list of values of the type specified by the first argument; 30 | #X text 654 379 2nd: list of values of the type specified by the third argument; 31 | #X text 650 297 3rd: data stream initializer (defualts to 192); 32 | #X text 648 197 5th (optional): data stream initializer (defaults to 192 \, check the serial_write.ino Arduino sketch for more details); 33 | #X msg 339 494 255; 34 | #X text 203 448 change number of analog and digital pins read; 35 | #X text 373 489 change data stream initializer (should be between 128 and 255 \, default is 192); 36 | #X text 41 115 You must specify the type of pins you want to read (analog or digital) and how many pins of this type you'll be reading. At least two arguments are necessary \, the third and fourth are optional \, you don't need them in case you read only one kind of pins. The fifth argument is also optional and sets a data stream initializer which defaults to 192 The order of the first four arguments must be aligned with the Arduino code. If you first read the analog pins \, then the first argument must be "analog" \, like in the example below.; 37 | #X text 41 281 Note: the digital pins are using the internal pull-up resistors \, using INPUT_PULLUP \, so you don't need to use resistors for switches in your circuit. For this reason the readings of the digital pins are inverted in the Arduino code so you get a 1 when you press a switch and a 0 when you release it.; 38 | #X msg 134 450 analog 0; 39 | #X msg 149 475 digital 1; 40 | #X obj 43 470 comport 0 57600; 41 | #X connect 0 0 38 0; 42 | #X connect 3 0 38 0; 43 | #X connect 4 0 5 0; 44 | #X connect 5 0 38 0; 45 | #X connect 11 0 12 0; 46 | #X connect 11 1 13 0; 47 | #X connect 12 0 17 0; 48 | #X connect 12 1 18 0; 49 | #X connect 12 2 19 0; 50 | #X connect 13 0 14 0; 51 | #X connect 13 1 15 0; 52 | #X connect 13 2 16 0; 53 | #X connect 31 0 11 2; 54 | #X connect 36 0 11 1; 55 | #X connect 37 0 11 1; 56 | #X connect 38 0 11 0; 57 | -------------------------------------------------------------------------------- /serial_print-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 307 127 1019 681 10; 2 | #X msg 54 398 close; 3 | #X obj 37 14 cnv 15 440 60 empty empty empty 20 12 0 14 #c0d828 #404040 0; 4 | #X text 746 624 Written by Alexandros Drymonitis; 5 | #X msg 43 371 devices; 6 | #X floatatom 103 379 5 0 0 0 - - - 0; 7 | #X msg 103 398 open \$1; 8 | #X text 45 22 [serial_print]: abstraction that works with Arduinos' Serial.print() and Serial.println() functions (with the use of [comport]); 9 | #X text 540 83 Inlets:; 10 | #X text 580 100 1st: bytes from [comport]; 11 | #X text 540 166 Outlets:; 12 | #X obj 43 485 s; 13 | #X floatatom 43 565 5 0 0 0 - - - 0; 14 | #X floatatom 83 565 5 0 0 0 - - - 0; 15 | #X floatatom 124 565 5 0 0 0 - - - 0; 16 | #X text 541 26 Arguments: delimiter type (tab \, space \, comma \, any). You can provide up to two arguments (cause three arguments is the same as "any"). if no argument is provided \, then all three symbols will work as delimiters; 17 | #X text 580 115 2nd: change delimiter type with a symbol (as with the arguments \, you can use two delimiters separated by a space \, e.g. "tab comma"); 18 | #X obj 43 541 unpack f f f, f 14; 19 | #X obj 173 541 unpack f f f; 20 | #X obj 173 564 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 21 | #X obj 207 564 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 22 | #X obj 242 564 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 23 | #X text 40 78 [serial_print] is a vanilla abstraction that works with [comport] and Arduino's Serial.print() and Serial.println() functions.; 24 | #N canvas 378 221 505 369 another_way_to_use_it 0; 25 | #X msg 49 140 close; 26 | #X msg 38 91 devices; 27 | #X floatatom 128 121 5 0 0 0 - - - 0; 28 | #X msg 128 140 open \$1; 29 | #X obj 38 183 comport; 30 | #X obj 38 227 list prepend; 31 | #X obj 38 249 list trim; 32 | #X floatatom 38 317 5 0 0 0 - - - 0; 33 | #X floatatom 78 317 5 0 0 0 - - - 0; 34 | #X floatatom 119 317 5 0 0 0 - - - 0; 35 | #X obj 38 295 unpack f f f; 36 | #X obj 162 295 unpack f f f; 37 | #X obj 162 316 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 38 | #X obj 202 316 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 39 | #X obj 243 316 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; 40 | #X text 36 43 Instead of [send] and [receive] \, you can also use [route] \, but the [send]/[receive] technique might be a bit more intuitive...; 41 | #X text 38 13 Close [comport] on the parent patch before attempting to open this one.; 42 | #X obj 38 271 route Analog_values: Digital_values:; 43 | #X obj 38 205 serial_print any; 44 | #X obj 49 118 loadbang; 45 | #X connect 0 0 4 0; 46 | #X connect 1 0 4 0; 47 | #X connect 2 0 3 0; 48 | #X connect 3 0 4 0; 49 | #X connect 4 0 18 0; 50 | #X connect 5 0 6 0; 51 | #X connect 6 0 17 0; 52 | #X connect 10 0 7 0; 53 | #X connect 10 1 8 0; 54 | #X connect 10 2 9 0; 55 | #X connect 11 0 12 0; 56 | #X connect 11 1 13 0; 57 | #X connect 11 2 14 0; 58 | #X connect 17 0 10 0; 59 | #X connect 17 1 11 0; 60 | #X connect 18 0 5 0; 61 | #X connect 18 1 5 1; 62 | #X connect 19 0 0 0; 63 | #X restore 43 595 pd another_way_to_use_it; 64 | #X text 40 237 This help patch works with the serial_print.ino sketch. Check it for more information.; 65 | #X text 584 184 1st: list of values of a group.; 66 | #X text 583 205 2nd: string to be used as a tag for a value group (print this first from the Arduino so that it works \, otherwise you'll probably get strange results). This comes out first \, then the value list out the left outlet; 67 | #X text 40 120 You can use commas \, spaces or tabs in between values to separate them. You can choose your delimiter via an argument (tab \, space \, comma or any \, or no argument which is the same as any). A string must precede a value group \, which will be used as a tag \, sent to the right inlet of [send] \, and used as an argument to the corresponding [receive]. The last value of each group must be printed with Serial.println() \, in order for [serial_print] to know a value group has ended.; 68 | #N canvas 197 82 892 524 receive_floats_strings_and_bangs 0; 69 | #X obj 72 24 vradio 15 1 0 5 empty empty empty 0 -8 0 10 #fcfcfc #000000 #000000 0; 70 | #X obj 72 184 serial_print; 71 | #X obj 72 206 s; 72 | #X symbolatom 186 255 0 0 0 0 - - - 0; 73 | #X obj 72 162 comport; 74 | #X obj 100 110 loadbang; 75 | #X msg 100 132 close; 76 | #X floatatom 165 111 5 0 0 0 - - - 0; 77 | #X msg 165 130 open \$1; 78 | #X text 90 53 outputs a bang; 79 | #X text 90 37 outputs a string; 80 | #X floatatom 72 256 0 0 0 0 - - - 0; 81 | #X text 90 21 outputs a float; 82 | #X text 90 69 outputs a negative number; 83 | #X floatatom 432 256 0 0 0 0 - - - 0; 84 | #X text 90 83 outputs a mixed list; 85 | #X obj 432 234 r negative_float; 86 | #X obj 314 234 r a_bang; 87 | #X obj 562 234 r mixed_list; 88 | #X floatatom 562 456 0 0 0 0 - - - 0; 89 | #X floatatom 601 431 0 0 0 0 - - - 0; 90 | #X obj 562 408 unpack; 91 | #X obj 613 279 print bang_in_list; 92 | #X obj 562 256 route list bang; 93 | #X obj 562 372 route a_string_in_a_list another_list_string last_list_string; 94 | #X floatatom 663 456 0 0 0 0 - - - 0; 95 | #X floatatom 702 431 0 0 0 0 - - - 0; 96 | #X obj 663 408 unpack; 97 | #X floatatom 765 456 0 0 0 0 - - - 0; 98 | #X floatatom 804 431 0 0 0 0 - - - 0; 99 | #X obj 765 408 unpack; 100 | #X obj 614 316 list split 1; 101 | #X symbolatom 614 338 0 0 0 0 - - - 0; 102 | #X obj 562 299 t a a; 103 | #X obj 314 256 print a_bang; 104 | #X obj 72 234 r a_float; 105 | #X obj 186 233 r a_string; 106 | #X text 442 36 With [serial_print] it's possible to receive floats \, strings \, negative values \, or even bangs. All these types can be included in a list. A bang though \, since it can't be included in a list \, will always be output last \, no matter where it is placed in the Arduino code. Close [comport] in the parent patch and load the float_string_bang.ino sketch to your Arduino board. Then open its serial port in this subpatch and click on the radio buttons below.; 107 | #X text 442 158 Note: [receive] arguments like "symbol" or "float" are possible \, but in general it's probably not a very good idea to use them since these words have a special meaning in Pd.; 108 | #X connect 0 0 4 0; 109 | #X connect 1 0 2 0; 110 | #X connect 1 1 2 1; 111 | #X connect 4 0 1 0; 112 | #X connect 5 0 6 0; 113 | #X connect 6 0 4 0; 114 | #X connect 7 0 8 0; 115 | #X connect 8 0 4 0; 116 | #X connect 16 0 14 0; 117 | #X connect 17 0 34 0; 118 | #X connect 18 0 23 0; 119 | #X connect 21 0 19 0; 120 | #X connect 21 1 20 0; 121 | #X connect 23 0 33 0; 122 | #X connect 23 1 22 0; 123 | #X connect 24 0 21 0; 124 | #X connect 24 1 27 0; 125 | #X connect 24 2 30 0; 126 | #X connect 27 0 25 0; 127 | #X connect 27 1 26 0; 128 | #X connect 30 0 28 0; 129 | #X connect 30 1 29 0; 130 | #X connect 31 0 32 0; 131 | #X connect 33 0 24 0; 132 | #X connect 33 1 31 0; 133 | #X connect 35 0 11 0; 134 | #X connect 36 0 3 0; 135 | #X restore 43 621 pd receive_floats_strings_and_bangs; 136 | #X obj 43 463 serial_print any; 137 | #X text 41 278 Note: the digital pins are using the internal pull-up resistors \, using INPUT_PULLUP \, so you don't need to use resistors for switches. For this reason the readings of the digital pins are inverted so you get a 0 when you press a switch and a 1 when you release it.; 138 | #X obj 43 441 comport 0 9600; 139 | #X obj 43 517 r Analog_values; 140 | #X obj 173 517 r Digital_values; 141 | #X connect 0 0 30 0; 142 | #X connect 3 0 30 0; 143 | #X connect 4 0 5 0; 144 | #X connect 5 0 30 0; 145 | #X connect 16 0 11 0; 146 | #X connect 16 1 12 0; 147 | #X connect 16 2 13 0; 148 | #X connect 17 0 18 0; 149 | #X connect 17 1 19 0; 150 | #X connect 17 2 20 0; 151 | #X connect 28 0 10 0; 152 | #X connect 28 1 10 1; 153 | #X connect 30 0 28 0; 154 | #X connect 31 0 16 0; 155 | #X connect 32 0 17 0; 156 | -------------------------------------------------------------------------------- /serial_print13-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 307 127 1019 681 10; 2 | #X msg 54 398 close; 3 | #X obj 37 14 cnv 15 440 60 empty empty empty 20 12 0 14 -200075 -66577 4 | 0; 5 | #X text 746 624 Written by Alexandros Drymonitis; 6 | #X msg 43 371 devices; 7 | #X floatatom 103 379 5 0 0 0 - - -, f 5; 8 | #X msg 103 398 open \$1; 9 | #X text 45 22 [serial_print]: abstraction that works with Arduinos' 10 | Serial.print() and Serial.println() functions (with the use of [comport]) 11 | ; 12 | #X text 540 83 Inlets:; 13 | #X text 580 100 1st: bytes from [comport]; 14 | #X text 540 166 Outlets:; 15 | #X obj 43 485 s; 16 | #X floatatom 43 565 5 0 0 0 - - -, f 5; 17 | #X floatatom 83 565 5 0 0 0 - - -, f 5; 18 | #X floatatom 124 565 5 0 0 0 - - -, f 5; 19 | #X text 541 26 Arguments: delimiter type (tab \, space \, comma \, 20 | any). You can provide up to two arguments (cause three arguments is 21 | the same as "any"). if no argument is provided \, then all three symbols 22 | will work as delimiters; 23 | #X text 580 115 2nd: change delimiter type with a symbol (as with the 24 | arguments \, you can use two delimiters separated by a space \, e.g. 25 | "tab comma"); 26 | #X obj 43 541 unpack f f f; 27 | #X obj 173 541 unpack f f f; 28 | #X obj 173 564 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 29 | 1; 30 | #X obj 213 564 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 31 | 1; 32 | #X obj 254 564 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 33 | 1; 34 | #X text 40 78 [serial_print] is a vanilla abstraction that works with 35 | [comport] and Arduino's Serial.print() and Serial.println() functions. 36 | ; 37 | #N canvas 378 221 505 369 another_way_to_use_it 0; 38 | #X msg 49 140 close; 39 | #X msg 38 91 devices; 40 | #X floatatom 128 121 5 0 0 0 - - -, f 5; 41 | #X msg 128 140 open \$1; 42 | #X obj 38 183 comport; 43 | #X obj 38 227 list prepend; 44 | #X obj 38 249 list trim; 45 | #X floatatom 38 317 5 0 0 0 - - -, f 5; 46 | #X floatatom 78 317 5 0 0 0 - - -, f 5; 47 | #X floatatom 119 317 5 0 0 0 - - -, f 5; 48 | #X obj 38 295 unpack f f f; 49 | #X obj 162 295 unpack f f f; 50 | #X obj 162 316 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 51 | 1; 52 | #X obj 202 316 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 53 | 1; 54 | #X obj 243 316 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 55 | 1; 56 | #X text 36 43 Instead of [send] and [receive] \, you can also use [route] 57 | \, but the [send]/[receive] technique might be a bit more intuitive... 58 | ; 59 | #X text 38 13 Close [comport] on the parent patch before attempting 60 | to open this one.; 61 | #X obj 38 271 route Analog_values: Digital_values:; 62 | #X obj 49 118 loadbang; 63 | #X obj 38 205 serial_print13 any; 64 | #X connect 0 0 4 0; 65 | #X connect 1 0 4 0; 66 | #X connect 2 0 3 0; 67 | #X connect 3 0 4 0; 68 | #X connect 4 0 19 0; 69 | #X connect 5 0 6 0; 70 | #X connect 6 0 17 0; 71 | #X connect 10 0 7 0; 72 | #X connect 10 1 8 0; 73 | #X connect 10 2 9 0; 74 | #X connect 11 0 12 0; 75 | #X connect 11 1 13 0; 76 | #X connect 11 2 14 0; 77 | #X connect 17 0 10 0; 78 | #X connect 17 1 11 0; 79 | #X connect 18 0 0 0; 80 | #X connect 19 0 5 0; 81 | #X connect 19 1 5 1; 82 | #X restore 43 595 pd another_way_to_use_it; 83 | #X text 40 237 This help patch works with the serial_print.ino sketch. 84 | Check it for more information.; 85 | #X text 584 184 1st: list of values of a group.; 86 | #X text 583 205 2nd: string to be used as a tag for a value group (print 87 | this first from the Arduino so that it works \, otherwise you'll probably 88 | get strange results). This comes out first \, then the value list out 89 | the left outlet; 90 | #X obj 43 517 r Analog_values:; 91 | #X obj 173 517 r Digital_values:; 92 | #X text 40 120 You can use commas \, spaces or tabs in between values 93 | to separate them. You can choose your delimiter via an argument (tab 94 | \, space \, comma or any \, or no argument which is the same as any). 95 | A string must precede a value group \, which will be used as a tag 96 | \, sent to the right inlet of [send] \, and used as an argument to 97 | the corresponding [receive]. The last value of each group must be printed 98 | with Serial.println() \, in order for [serial_print] to know a value 99 | group has ended.; 100 | #N canvas 197 82 892 524 receive_floats_strings_and_bangs 0; 101 | #X obj 72 24 vradio 15 1 0 5 empty empty empty 0 -8 0 10 -262144 -1 102 | -1 4; 103 | #X obj 72 206 s; 104 | #X symbolatom 186 255 0 0 0 0 - - -; 105 | #X obj 72 162 comport; 106 | #X obj 100 110 loadbang; 107 | #X msg 100 132 close; 108 | #X floatatom 165 111 5 0 0 0 - - -, f 5; 109 | #X msg 165 130 open \$1; 110 | #X text 90 53 outputs a bang; 111 | #X text 90 37 outputs a string; 112 | #X floatatom 72 256 0 0 0 0 - - -; 113 | #X text 90 21 outputs a float; 114 | #X text 90 69 outputs a negative number; 115 | #X floatatom 432 256 0 0 0 0 - - -; 116 | #X text 90 83 outputs a mixed list; 117 | #X obj 432 234 r negative_float; 118 | #X obj 314 234 r a_bang; 119 | #X obj 562 234 r mixed_list; 120 | #X floatatom 562 456 0 0 0 0 - - -; 121 | #X floatatom 601 431 0 0 0 0 - - -; 122 | #X obj 562 408 unpack; 123 | #X obj 613 279 print bang_in_list; 124 | #X obj 562 256 route list bang; 125 | #X obj 562 372 route a_string_in_a_list another_list_string last_list_string 126 | ; 127 | #X floatatom 663 456 0 0 0 0 - - -; 128 | #X floatatom 702 431 0 0 0 0 - - -; 129 | #X obj 663 408 unpack; 130 | #X floatatom 765 456 0 0 0 0 - - -; 131 | #X floatatom 804 431 0 0 0 0 - - -; 132 | #X obj 765 408 unpack; 133 | #X obj 614 316 list split 1; 134 | #X symbolatom 614 338 0 0 0 0 - - -; 135 | #X obj 562 299 t a a; 136 | #X obj 314 256 print a_bang; 137 | #X obj 72 234 r a_float; 138 | #X obj 186 233 r a_string; 139 | #X text 442 36 With [serial_print] it's possible to receive floats 140 | \, strings \, negative values \, or even bangs. All these types can 141 | be included in a list. A bang though \, since it can't be included 142 | in a list \, will always be output last \, no matter where it is placed 143 | in the Arduino code. Close [comport] in the parent patch and load the 144 | float_string_bang.ino sketch to your Arduino board. Then open its serial 145 | port in this subpatch and click on the radio buttons below.; 146 | #X text 442 158 Note: [receive] arguments like "symbol" or "float" 147 | are possible \, but in general it's probably not a very good idea to 148 | use them since these words have a special meaning in Pd.; 149 | #X obj 72 184 serial_print13; 150 | #X connect 0 0 3 0; 151 | #X connect 3 0 38 0; 152 | #X connect 4 0 5 0; 153 | #X connect 5 0 3 0; 154 | #X connect 6 0 7 0; 155 | #X connect 7 0 3 0; 156 | #X connect 15 0 13 0; 157 | #X connect 16 0 33 0; 158 | #X connect 17 0 22 0; 159 | #X connect 20 0 18 0; 160 | #X connect 20 1 19 0; 161 | #X connect 22 0 32 0; 162 | #X connect 22 1 21 0; 163 | #X connect 23 0 20 0; 164 | #X connect 23 1 26 0; 165 | #X connect 23 2 29 0; 166 | #X connect 26 0 24 0; 167 | #X connect 26 1 25 0; 168 | #X connect 29 0 27 0; 169 | #X connect 29 1 28 0; 170 | #X connect 30 0 31 0; 171 | #X connect 32 0 23 0; 172 | #X connect 32 1 30 0; 173 | #X connect 34 0 10 0; 174 | #X connect 35 0 2 0; 175 | #X connect 38 0 1 0; 176 | #X connect 38 1 1 1; 177 | #X restore 43 621 pd receive_floats_strings_and_bangs; 178 | #X obj 43 441 comport 1 9600; 179 | #X text 41 278 Note: the digital pins are using the internal pull-up 180 | resistors \, using INPUT_PULLUP \, so you don't need to use resistors 181 | for switches. For this reason the readings of the digital pins are 182 | inverted so you get a 0 when you press a switch and a 1 when you release 183 | it.; 184 | #X obj 43 463 serial_print13 any; 185 | #X connect 0 0 30 0; 186 | #X connect 3 0 30 0; 187 | #X connect 4 0 5 0; 188 | #X connect 5 0 30 0; 189 | #X connect 16 0 11 0; 190 | #X connect 16 1 12 0; 191 | #X connect 16 2 13 0; 192 | #X connect 17 0 18 0; 193 | #X connect 17 1 19 0; 194 | #X connect 17 2 20 0; 195 | #X connect 26 0 16 0; 196 | #X connect 27 0 17 0; 197 | #X connect 30 0 32 0; 198 | #X connect 32 0 10 0; 199 | #X connect 32 1 10 1; 200 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | 167 | -------------------------------------------------------------------------------- /serial_write.pd: -------------------------------------------------------------------------------- 1 | #N canvas 711 464 732 457 10; 2 | #X obj 30 102 inlet; 3 | #X obj 30 353 outlet; 4 | #X text 29 386 Written by Alexandros Drymonitis; 5 | #N canvas 520 265 636 354 repack 0; 6 | #X obj 36 27 inlet; 7 | #X obj 36 49 route float bang; 8 | #X obj 36 157 + 1; 9 | #X obj 84 206 t l l; 10 | #X obj 84 184 list prepend; 11 | #X obj 36 181 sel; 12 | #X obj 271 216 inlet data_amount; 13 | #X obj 63 251 outlet; 14 | #X obj 36 71 t b f; 15 | #X obj 63 229 list; 16 | #X obj 206 215 sel 0 1, f 8; 17 | #X obj 271 239 route 0 1; 18 | #X obj 206 257 f; 19 | #X obj 228 281 f; 20 | #X text 336 237 these are the two groups of values; 21 | #X obj 36 203 t b b; 22 | #X obj 36 134 f; 23 | #X obj 235 170 0; 24 | #X obj 206 170 1; 25 | #X obj 82 116 0; 26 | #X obj 82 93 t b b; 27 | #X obj 82 71 t b b, f 26; 28 | #X obj 179 103 t b b; 29 | #X connect 0 0 1 0; 30 | #X connect 1 0 8 0; 31 | #X connect 1 1 21 0; 32 | #X connect 2 0 16 1; 33 | #X connect 2 0 5 0; 34 | #X connect 3 0 9 1; 35 | #X connect 3 1 4 1; 36 | #X connect 4 0 3 0; 37 | #X connect 5 0 15 0; 38 | #X connect 6 0 11 0; 39 | #X connect 8 0 16 0; 40 | #X connect 8 1 4 0; 41 | #X connect 9 0 7 0; 42 | #X connect 10 0 12 0; 43 | #X connect 10 1 13 0; 44 | #X connect 11 0 12 1; 45 | #X connect 11 1 13 1; 46 | #X connect 12 0 5 1; 47 | #X connect 13 0 5 1; 48 | #X connect 15 0 22 0; 49 | #X connect 15 1 9 0; 50 | #X connect 16 0 2 0; 51 | #X connect 17 0 10 0; 52 | #X connect 18 0 10 0; 53 | #X connect 19 0 16 1; 54 | #X connect 20 0 19 0; 55 | #X connect 20 1 4 1; 56 | #X connect 21 0 20 0; 57 | #X connect 21 1 17 0; 58 | #X connect 22 0 20 0; 59 | #X connect 22 1 18 0; 60 | #X restore 30 232 pd repack; 61 | #X obj 227 296 outlet; 62 | #X obj 402 190 inlet change_num_of_data; 63 | #X obj 234 190 t f f; 64 | #N canvas 665 319 874 377 \$0-route_list 0; 65 | #X obj 31 249 f; 66 | #X obj 61 249 == 0; 67 | #X obj 31 48 t b l; 68 | #X obj 31 26 inlet; 69 | #X obj 31 272 list append; 70 | #X obj 31 318 outlet; 71 | #X obj 130 318 outlet; 72 | #X obj 130 274 inlet which_is_analog; 73 | #N canvas 164 589 450 300 specify_analog 0; 74 | #X obj 55 130 t l l; 75 | #X obj 55 173 spigot; 76 | #X obj 105 173 spigot; 77 | #X obj 205 130 t l l; 78 | #X obj 205 173 spigot; 79 | #X obj 255 173 spigot; 80 | #N canvas 505 251 499 346 assemble_analog 0; 81 | #X obj 38 81 list split 2; 82 | #X obj 53 106 list; 83 | #X obj 144 152 unpack; 84 | #X obj 144 192 +; 85 | #X obj 183 174 * 128; 86 | #X obj 38 56 inlet bytes; 87 | #X obj 119 282 outlet; 88 | #X obj 144 215 list prepend; 89 | #X obj 144 237 t l l; 90 | #X obj 38 134 t b l; 91 | #X obj 119 259 list; 92 | #X obj 119 104 t b b; 93 | #X text 36 10 this used to be the [read_analog_pins] abstraction \, which is now integrated in the [serial_write] abstraction.; 94 | #X connect 0 0 9 0; 95 | #X connect 0 1 1 1; 96 | #X connect 0 2 11 0; 97 | #X connect 1 0 0 0; 98 | #X connect 2 0 3 0; 99 | #X connect 2 1 4 0; 100 | #X connect 3 0 7 0; 101 | #X connect 4 0 3 1; 102 | #X connect 5 0 0 0; 103 | #X connect 7 0 8 0; 104 | #X connect 8 0 10 1; 105 | #X connect 8 1 7 1; 106 | #X connect 9 0 1 0; 107 | #X connect 9 1 2 0; 108 | #X connect 10 0 6 0; 109 | #X connect 11 0 10 0; 110 | #X connect 11 1 7 1; 111 | #X restore 105 203 pd assemble_analog; 112 | #N canvas 509 255 525 347 assemble_analog 0; 113 | #X obj 38 81 list split 2; 114 | #X obj 51 106 list; 115 | #X obj 144 152 unpack; 116 | #X obj 144 192 +; 117 | #X obj 183 174 * 128; 118 | #X obj 38 56 inlet bytes; 119 | #X obj 119 282 outlet; 120 | #X obj 144 215 list prepend; 121 | #X obj 144 237 t l l; 122 | #X obj 38 134 t b l; 123 | #X obj 119 259 list; 124 | #X obj 119 104 t b b; 125 | #X text 36 10 this used to be the [read_analog_pins] abstraction \, which is now integrated in the [serial_write] abstraction.; 126 | #X connect 0 0 9 0; 127 | #X connect 0 1 1 1; 128 | #X connect 0 2 11 0; 129 | #X connect 1 0 0 0; 130 | #X connect 2 0 3 0; 131 | #X connect 2 1 4 0; 132 | #X connect 3 0 7 0; 133 | #X connect 4 0 3 1; 134 | #X connect 5 0 0 0; 135 | #X connect 7 0 8 0; 136 | #X connect 8 0 10 1; 137 | #X connect 8 1 7 1; 138 | #X connect 9 0 1 0; 139 | #X connect 9 1 2 0; 140 | #X connect 10 0 6 0; 141 | #X connect 11 0 10 0; 142 | #X connect 11 1 7 1; 143 | #X restore 255 203 pd assemble_analog; 144 | #X obj 55 238 outlet; 145 | #X obj 205 238 outlet; 146 | #X obj 237 35 inlet which_is_analog; 147 | #X obj 138 149 == 0; 148 | #X obj 238 149 == 0; 149 | #X obj 237 57 t f f f f; 150 | #X obj 55 67 inlet; 151 | #X obj 55 89 route 0 1; 152 | #X connect 0 0 1 0; 153 | #X connect 0 1 2 0; 154 | #X connect 1 0 8 0; 155 | #X connect 2 0 6 0; 156 | #X connect 3 0 4 0; 157 | #X connect 3 1 5 0; 158 | #X connect 4 0 9 0; 159 | #X connect 5 0 7 0; 160 | #X connect 6 0 8 0; 161 | #X connect 7 0 9 0; 162 | #X connect 10 0 13 0; 163 | #X connect 11 0 2 1; 164 | #X connect 12 0 4 1; 165 | #X connect 13 0 1 1; 166 | #X connect 13 1 11 0; 167 | #X connect 13 2 12 0; 168 | #X connect 13 3 5 1; 169 | #X connect 14 0 15 0; 170 | #X connect 15 0 0 0; 171 | #X connect 15 1 3 0; 172 | #X restore 31 296 pd specify_analog; 173 | #X text 81 19 if we don't provide a second argument \, use 1 to compare [f] so that it always outputs 0 \, else use 0; 174 | #X obj 82 50 r \$0-num_args; 175 | #X obj 297 120 r \$0-arg_type; 176 | #X obj 240 142 sel analog; 177 | #X obj 240 97 r \$0-message_type; 178 | #X obj 297 164 t b; 179 | #X msg 297 231 0; 180 | #X obj 297 209 spigot; 181 | #X obj 82 74 t f f; 182 | #X text 343 212 if we have already provided four arguments \, then don't let the messages control whether we receive both analog and digital values; 183 | #X text 399 120 if we have provided two arguments only \, set the type of argument to see if a message we send is of the same type \, so that we don't change the alternating counter. if it's of the other type \, we need the counter to alternate between 0 and 1; 184 | #X connect 0 0 1 0; 185 | #X connect 0 0 4 0; 186 | #X connect 1 0 0 1; 187 | #X connect 2 0 0 0; 188 | #X connect 2 1 4 1; 189 | #X connect 3 0 2 0; 190 | #X connect 4 0 8 0; 191 | #X connect 7 0 8 1; 192 | #X connect 8 0 5 0; 193 | #X connect 8 1 6 0; 194 | #X connect 10 0 17 0; 195 | #X connect 11 0 12 1; 196 | #X connect 12 1 14 0; 197 | #X connect 13 0 12 0; 198 | #X connect 14 0 16 0; 199 | #X connect 15 0 1 1; 200 | #X connect 16 0 15 0; 201 | #X connect 17 0 1 1; 202 | #X connect 17 1 16 1; 203 | #X restore 30 256 pd \$0-route_list; 204 | #N canvas 401 264 799 340 \$0-change_num_of_data 0; 205 | #X obj 12 44 inlet which_is_analog; 206 | #X obj 175 67 route analog digital; 207 | #X obj 175 160 f; 208 | #X obj 221 142 t f f; 209 | #X obj 233 164 f; 210 | #X obj 175 182 pack; 211 | #X obj 175 252 outlet; 212 | #X obj 233 186 == 0; 213 | #X obj 233 208 pack, f 5; 214 | #X obj 175 20 inlet change_num_of_data; 215 | #X obj 202 112 * 2; 216 | #X obj 175 42 t a a; 217 | #X obj 358 60 unpack s f; 218 | #X obj 358 82 s \$0-message_type; 219 | #X obj 175 89 t b f; 220 | #X obj 233 90 t b f; 221 | #X connect 0 0 3 0; 222 | #X connect 1 0 14 0; 223 | #X connect 1 1 15 0; 224 | #X connect 2 0 5 0; 225 | #X connect 3 0 2 1; 226 | #X connect 3 1 4 1; 227 | #X connect 4 0 7 0; 228 | #X connect 5 0 6 0; 229 | #X connect 7 0 8 0; 230 | #X connect 8 0 6 0; 231 | #X connect 9 0 11 0; 232 | #X connect 10 0 5 1; 233 | #X connect 11 0 1 0; 234 | #X connect 11 1 12 0; 235 | #X connect 12 0 13 0; 236 | #X connect 14 0 2 0; 237 | #X connect 14 1 10 0; 238 | #X connect 15 0 4 0; 239 | #X connect 15 1 8 1; 240 | #X restore 261 214 pd \$0-change_num_of_data; 241 | #N canvas 186 125 982 483 \$0-assemble_num_of_data 0; 242 | #X obj 58 348 outlet; 243 | #X obj 58 36 loadbang; 244 | #X obj 58 92 t b b; 245 | #X obj 107 131 sel analog digital; 246 | #X msg 107 209 2; 247 | #X msg 159 231 1; 248 | #X obj 58 249 *; 249 | #X obj 58 58 t b b; 250 | #X obj 358 76 t b b; 251 | #X obj 358 106 \$2; 252 | #X obj 407 156 sel analog digital; 253 | #X obj 407 94 symbol \$1; 254 | #X msg 407 202 2; 255 | #X msg 459 202 1; 256 | #X obj 358 242 *; 257 | #X obj 107 110 symbol \$3; 258 | #X obj 58 114 \$4; 259 | #X msg 358 269 0 \$1; 260 | #X msg 58 271 1 \$1; 261 | #X text 395 269 first group of values; 262 | #X text 94 270 second group of values; 263 | #X text 55 2 analog values are split in two \, so we receive two bytes per value. digital values are being received as is.; 264 | #X obj 407 179 t b b; 265 | #X msg 510 197 0; 266 | #X obj 107 186 t b b; 267 | #X msg 195 204 1; 268 | #X obj 510 350 outlet which_is_analog; 269 | #X obj 244 171 s \$0-num_args; 270 | #X msg 543 174 at least two arguments needed; 271 | #X obj 407 116 t s s; 272 | #X obj 471 134 s \$0-arg_type; 273 | #X obj 543 196 print serial_write; 274 | #X obj 459 224 t f f; 275 | #X text 519 218 if first group is digital \, set which is analog \, because we might not receive further arguments \, in case we use only digital; 276 | #X msg 244 149 1; 277 | #X connect 1 0 7 0; 278 | #X connect 2 0 16 0; 279 | #X connect 2 1 15 0; 280 | #X connect 3 0 24 0; 281 | #X connect 3 1 5 0; 282 | #X connect 3 2 34 0; 283 | #X connect 4 0 6 1; 284 | #X connect 5 0 6 1; 285 | #X connect 6 0 18 0; 286 | #X connect 7 0 2 0; 287 | #X connect 7 1 8 0; 288 | #X connect 8 0 9 0; 289 | #X connect 8 1 11 0; 290 | #X connect 9 0 14 0; 291 | #X connect 10 0 22 0; 292 | #X connect 10 1 13 0; 293 | #X connect 10 2 28 0; 294 | #X connect 11 0 29 0; 295 | #X connect 12 0 14 1; 296 | #X connect 13 0 32 0; 297 | #X connect 14 0 17 0; 298 | #X connect 15 0 3 0; 299 | #X connect 16 0 6 0; 300 | #X connect 17 0 0 0; 301 | #X connect 18 0 0 0; 302 | #X connect 22 0 12 0; 303 | #X connect 22 1 23 0; 304 | #X connect 23 0 26 0; 305 | #X connect 24 0 4 0; 306 | #X connect 24 1 25 0; 307 | #X connect 25 0 26 0; 308 | #X connect 28 0 31 0; 309 | #X connect 29 0 10 0; 310 | #X connect 29 1 30 0; 311 | #X connect 32 0 14 1; 312 | #X connect 32 1 26 0; 313 | #X connect 34 0 27 0; 314 | #X restore 81 166 pd \$0-assemble_num_of_data; 315 | #N canvas 579 351 354 270 set_initializer 0; 316 | #X obj 57 70 loadbang; 317 | #X obj 57 92 \$5; 318 | #X obj 57 114 sel 0; 319 | #X msg 57 136 192; 320 | #X obj 57 158 outlet; 321 | #X obj 126 70 inlet; 322 | #X connect 0 0 1 0; 323 | #X connect 1 0 2 0; 324 | #X connect 2 0 3 0; 325 | #X connect 2 1 4 0; 326 | #X connect 3 0 4 0; 327 | #X connect 5 0 2 0; 328 | #X restore 514 62 pd set_initializer; 329 | #X obj 514 40 inlet; 330 | #X obj 83 287 r \$0-num_args; 331 | #X obj 30 305 spigot; 332 | #X obj 30 330 list; 333 | #X obj 30 278 t b l; 334 | #X text 80 316 if we receive two arguments only \, force a bang when the first package finishes; 335 | #X obj 30 147 select; 336 | #X obj 195 274 t b l; 337 | #X obj 30 124 spigot; 338 | #X obj 514 84 t b f; 339 | #X msg 514 107 1; 340 | #X text 27 9 This abstraction uses the technique found in the rePatcher by Open Music Labs (slightly modified) \, to receive data from the Arduino. It needs a unique byte to denote the beginning of the data stream (which is 192 by default \, [sel]s' argument) after which \, all bytes are being collected by [pd repack] and dumped as a list.; 341 | #X connect 0 0 19 0; 342 | #X connect 3 0 7 0; 343 | #X connect 5 0 8 1; 344 | #X connect 6 0 7 1; 345 | #X connect 6 1 8 0; 346 | #X connect 7 0 15 0; 347 | #X connect 7 1 18 0; 348 | #X connect 8 0 3 1; 349 | #X connect 9 0 3 1; 350 | #X connect 9 1 6 0; 351 | #X connect 10 0 20 0; 352 | #X connect 11 0 10 0; 353 | #X connect 12 0 13 1; 354 | #X connect 13 0 14 0; 355 | #X connect 14 0 1 0; 356 | #X connect 15 0 13 0; 357 | #X connect 15 1 14 1; 358 | #X connect 17 0 3 0; 359 | #X connect 17 1 3 0; 360 | #X connect 18 0 14 0; 361 | #X connect 18 1 4 0; 362 | #X connect 19 0 17 0; 363 | #X connect 20 0 21 0; 364 | #X connect 20 1 17 1; 365 | #X connect 21 0 19 1; 366 | -------------------------------------------------------------------------------- /serial_print.pd: -------------------------------------------------------------------------------- 1 | #N canvas 868 101 618 555 10; 2 | #X obj 47 120 inlet; 3 | #X text 374 491 written by Alexandros Drymonitis; 4 | #X obj 47 142 sel 10 13; 5 | #X obj 199 113 inlet delimiter; 6 | #X obj 384 370 outlet symbol; 7 | #X obj 66 514 outlet list; 8 | #N canvas 62 297 639 403 \$0-set_argument 0; 9 | #X obj 24 7 loadbang; 10 | #X obj 24 245 symbol \$1; 11 | #X obj 24 269 sel tab space comma any; 12 | #X obj 75 53 inlet; 13 | #X obj 372 46 symbol \$2; 14 | #X obj 24 29 t b b; 15 | #X obj 298 204 list append; 16 | #X msg 372 91 9; 17 | #X msg 409 91 32; 18 | #X obj 372 69 sel tab space comma; 19 | #X msg 446 91 44; 20 | #X msg 24 301 9; 21 | #X msg 57 301 32; 22 | #X msg 91 301 44; 23 | #X msg 125 301 9 32 44; 24 | #X msg 483 91 0; 25 | #X obj 225 120 t b s; 26 | #X obj 168 98 route bang; 27 | #X obj 168 120 t b b; 28 | #X text 164 138 if we provide one symbol only \, clear [list append] first; 29 | #X obj 298 273 outlet arg_list; 30 | #X obj 367 249 outlet num_args; 31 | #N canvas 675 248 516 378 drip_list 0; 32 | #X obj 69 60 until; 33 | #X obj 69 82 list; 34 | #X obj 69 104 list split 1; 35 | #X obj 69 14 inlet; 36 | #X obj 69 126 sel 0; 37 | #X obj 218 122 t b b; 38 | #X obj 96 149 t b f; 39 | #X obj 96 193 f; 40 | #X obj 126 193 + 1; 41 | #X obj 96 215 t f f; 42 | #X obj 218 212 f; 43 | #X obj 96 237 pack; 44 | #X obj 69 36 t b l b; 45 | #X msg 111 171 1; 46 | #X text 59 299 force a zero as the second argument if only one symbol is given via argument \, and exclude it from the list; 47 | #X obj 96 259 outlet arg_list; 48 | #X obj 218 234 outlet num_args; 49 | #X connect 0 0 1 0; 50 | #X connect 1 0 2 0; 51 | #X connect 2 0 4 0; 52 | #X connect 2 1 1 1; 53 | #X connect 2 2 5 0; 54 | #X connect 3 0 12 0; 55 | #X connect 4 1 6 0; 56 | #X connect 5 0 10 0; 57 | #X connect 5 1 0 1; 58 | #X connect 6 0 7 0; 59 | #X connect 6 1 11 1; 60 | #X connect 7 0 8 0; 61 | #X connect 7 0 9 0; 62 | #X connect 8 0 7 1; 63 | #X connect 9 0 11 0; 64 | #X connect 9 1 10 1; 65 | #X connect 10 0 16 0; 66 | #X connect 11 0 15 0; 67 | #X connect 12 0 0 0; 68 | #X connect 12 1 1 1; 69 | #X connect 12 2 13 0; 70 | #X connect 13 0 7 1; 71 | #X restore 298 227 pd drip_list; 72 | #N canvas 442 90 736 575 split_symbols 0; 73 | #X obj 34 24 inlet; 74 | #X obj 126 108 until; 75 | #X obj 126 130 list; 76 | #X obj 126 152 list split 1; 77 | #X obj 126 214 sel 32; 78 | #X obj 235 232 list prepend; 79 | #X obj 235 254 t l l; 80 | #X obj 126 236 t b b; 81 | #X obj 214 276 list; 82 | #X obj 214 298 list tosymbol; 83 | #X obj 34 47 list fromsymbol; 84 | #X obj 214 371 f; 85 | #X obj 242 371 + 1; 86 | #X msg 229 350 0; 87 | #X obj 126 87 t b l b b; 88 | #X obj 214 427 pack f s; 89 | #X obj 214 326 t b s; 90 | #X obj 214 521 outlet; 91 | #X obj 296 505 outlet; 92 | #X obj 214 449 route 0 1; 93 | #X obj 214 499 symbol; 94 | #X obj 244 472 symbol; 95 | #X obj 195 174 t b b b; 96 | #X obj 296 472 spigot; 97 | #X obj 335 450 == 0; 98 | #X obj 214 393 t f f; 99 | #X obj 34 69 route bang; 100 | #X msg 34 91 97 110 121; 101 | #X text 153 46 if we receive an empty symbol \, we'll force the list of the symbol "any"; 102 | #X text 173 211 we use space to split the two symbols; 103 | #X text 324 233 every time we output one symbol \, clear this list; 104 | #X text 343 472 if we provide one symbol only \, send a bang out this outet; 105 | #X text 251 152 if only one symbol is received (hence \, no space) \, bang the right outlet of this subpatch explicitly \, so the symbol can pass; 106 | #X connect 0 0 10 0; 107 | #X connect 1 0 2 0; 108 | #X connect 2 0 3 0; 109 | #X connect 3 0 4 0; 110 | #X connect 3 1 2 1; 111 | #X connect 3 2 22 0; 112 | #X connect 4 0 7 0; 113 | #X connect 4 1 5 0; 114 | #X connect 5 0 6 0; 115 | #X connect 6 0 8 1; 116 | #X connect 6 1 5 1; 117 | #X connect 7 0 8 0; 118 | #X connect 7 1 5 1; 119 | #X connect 8 0 9 0; 120 | #X connect 9 0 16 0; 121 | #X connect 10 0 26 0; 122 | #X connect 11 0 12 0; 123 | #X connect 11 0 25 0; 124 | #X connect 12 0 11 1; 125 | #X connect 13 0 11 1; 126 | #X connect 14 0 1 0; 127 | #X connect 14 1 2 1; 128 | #X connect 14 2 13 0; 129 | #X connect 14 3 5 1; 130 | #X connect 15 0 19 0; 131 | #X connect 16 0 11 0; 132 | #X connect 16 1 15 1; 133 | #X connect 19 0 20 0; 134 | #X connect 19 1 21 0; 135 | #X connect 20 0 17 0; 136 | #X connect 21 0 18 0; 137 | #X connect 22 0 23 0; 138 | #X connect 22 1 8 0; 139 | #X connect 22 2 1 1; 140 | #X connect 23 0 18 0; 141 | #X connect 24 0 23 1; 142 | #X connect 25 0 15 0; 143 | #X connect 25 1 24 0; 144 | #X connect 26 0 27 0; 145 | #X connect 26 1 14 0; 146 | #X connect 27 0 14 0; 147 | #X restore 75 76 pd split_symbols; 148 | #X connect 0 0 5 0; 149 | #X connect 1 0 2 0; 150 | #X connect 2 0 11 0; 151 | #X connect 2 1 12 0; 152 | #X connect 2 2 13 0; 153 | #X connect 2 3 14 0; 154 | #X connect 2 4 14 0; 155 | #X connect 3 0 23 0; 156 | #X connect 4 0 9 0; 157 | #X connect 5 0 1 0; 158 | #X connect 5 1 4 0; 159 | #X connect 6 0 22 0; 160 | #X connect 7 0 6 1; 161 | #X connect 8 0 6 1; 162 | #X connect 9 0 7 0; 163 | #X connect 9 1 8 0; 164 | #X connect 9 2 10 0; 165 | #X connect 9 3 15 0; 166 | #X connect 10 0 6 1; 167 | #X connect 11 0 6 0; 168 | #X connect 12 0 6 0; 169 | #X connect 13 0 6 0; 170 | #X connect 14 0 6 0; 171 | #X connect 15 0 6 1; 172 | #X connect 16 0 1 0; 173 | #X connect 16 1 4 0; 174 | #X connect 17 0 18 0; 175 | #X connect 17 1 16 0; 176 | #X connect 18 0 1 0; 177 | #X connect 18 1 6 1; 178 | #X connect 22 0 20 0; 179 | #X connect 22 1 21 0; 180 | #X connect 23 0 1 1; 181 | #X connect 23 1 17 0; 182 | #X restore 199 135 pd \$0-set_argument; 183 | #X text 40 20 to be used with [comport] for utilising Arduinos' Serial.print() and Serial.println() functions; 184 | #X obj 93 447 list; 185 | #N canvas 293 276 844 259 delimiter 0; 186 | #X obj 38 176 outlet bang; 187 | #X obj 38 32 inlet; 188 | #X obj 38 57 sel; 189 | #X obj 56 80 sel; 190 | #X obj 74 102 sel; 191 | #X obj 91 39 route 1 2 3; 192 | #X obj 305 34 swap 3; 193 | #X obj 305 56 -; 194 | #X obj 305 78 t f b; 195 | #X obj 305 100 until; 196 | #X obj 305 144 f; 197 | #X obj 335 144 - 1; 198 | #X msg 320 122 3; 199 | #X obj 305 166 pack f 256; 200 | #X text 361 61 set 256 to [sel]s that are not used (if we provide one or two arguments \, for example) \, cause this number will never go through [comport] (it's 8-bits plus 1); 201 | #X obj 129 120 outlet through; 202 | #X obj 91 17 inlet arg_list; 203 | #X obj 305 12 inlet num_args; 204 | #X connect 1 0 2 0; 205 | #X connect 2 0 0 0; 206 | #X connect 2 1 3 0; 207 | #X connect 3 0 0 0; 208 | #X connect 3 1 4 0; 209 | #X connect 4 0 0 0; 210 | #X connect 4 1 15 0; 211 | #X connect 5 0 2 1; 212 | #X connect 5 1 3 1; 213 | #X connect 5 2 4 1; 214 | #X connect 6 0 7 0; 215 | #X connect 6 1 7 1; 216 | #X connect 7 0 8 0; 217 | #X connect 8 0 9 0; 218 | #X connect 8 1 12 0; 219 | #X connect 9 0 10 0; 220 | #X connect 10 0 11 0; 221 | #X connect 10 0 13 0; 222 | #X connect 11 0 10 1; 223 | #X connect 12 0 10 1; 224 | #X connect 13 0 5 0; 225 | #X connect 16 0 5 0; 226 | #X connect 17 0 6 0; 227 | #X restore 165 160 pd delimiter; 228 | #N canvas 372 82 841 654 \$0-assemble_float 0; 229 | #X obj 103 366 t f b; 230 | #X obj 103 458 +; 231 | #X obj 130 393 f; 232 | #X obj 130 440 * 10; 233 | #X msg 145 234 0; 234 | #X obj 103 480 t f f; 235 | #X obj 21 498 f; 236 | #X obj 103 343 - 48; 237 | #X obj 21 194 inlet get; 238 | #X obj 201 63 inlet val; 239 | #X obj 21 584 outlet; 240 | #N canvas 155 167 262 222 bang_once 0; 241 | #X obj 64 91 inlet; 242 | #X obj 64 113 spigot; 243 | #X obj 64 135 t b b; 244 | #X msg 117 95 0; 245 | #X obj 64 157 outlet; 246 | #X obj 103 45 inlet reset; 247 | #X msg 103 67 1; 248 | #X connect 0 0 1 0; 249 | #X connect 1 0 2 0; 250 | #X connect 2 0 4 0; 251 | #X connect 2 1 3 0; 252 | #X connect 3 0 1 1; 253 | #X connect 5 0 6 0; 254 | #X connect 6 0 1 1; 255 | #X restore 285 229 pd bang_once; 256 | #X msg 415 233 0; 257 | #X msg 285 299 1; 258 | #X obj 21 339 spigot; 259 | #X obj 21 216 t b b; 260 | #N canvas 386 453 292 235 set_decimal_place 0; 261 | #X obj 36 26 inlet; 262 | #X obj 66 104 + 1; 263 | #X obj 36 126 swap 10; 264 | #X obj 36 148 pow; 265 | #X obj 36 193 outlet; 266 | #X obj 36 104 f; 267 | #X obj 36 71 spigot; 268 | #X obj 122 31 inlet; 269 | #X obj 122 53 t f f; 270 | #X obj 69 46 inlet; 271 | #X obj 36 170 pow -1; 272 | #X connect 0 0 6 0; 273 | #X connect 1 0 5 1; 274 | #X connect 2 0 3 0; 275 | #X connect 2 1 3 1; 276 | #X connect 3 0 10 0; 277 | #X connect 5 0 1 0; 278 | #X connect 5 0 2 0; 279 | #X connect 6 0 5 0; 280 | #X connect 7 0 8 0; 281 | #X connect 8 0 6 1; 282 | #X connect 8 1 5 0; 283 | #X connect 9 0 6 1; 284 | #X connect 10 0 4 0; 285 | #X restore 265 372 pd set_decimal_place; 286 | #X obj 246 201 t f b b; 287 | #X msg 201 400 1; 288 | #X msg 151 418 10; 289 | #X obj 201 422 t f f; 290 | #X obj 285 321 t f f; 291 | #X obj 201 115 moses 48; 292 | #X obj 246 137 moses 58; 293 | #X obj 415 255 t f f; 294 | #X obj 291 50 r \$0-symbol; 295 | #X msg 291 72 0; 296 | #X obj 341 283 s \$0-digits; 297 | #X text 414 285 if digits start coming in \, close symbol's [spigot]; 298 | #X text 326 73 if symbols start coming in \, close [spigot] so that the symbol can also contain digits; 299 | #X obj 468 251 t f f; 300 | #X msg 468 229 1; 301 | #X obj 381 189 r \$0-delimit; 302 | #X obj 304 480 f; 303 | #X obj 319 457 r \$0-hyphen; 304 | #X obj 285 265 t b b b; 305 | #X obj 201 162 sel 46; 306 | #X obj 304 502 sel 45; 307 | #X msg 304 544 -1; 308 | #X obj 381 211 t b b b b; 309 | #X obj 201 90 spigot 1; 310 | #X obj 21 561 * 1; 311 | #X obj 103 389 * 1; 312 | #X connect 0 0 42 0; 313 | #X connect 0 1 2 0; 314 | #X connect 1 0 5 0; 315 | #X connect 2 0 3 0; 316 | #X connect 3 0 1 1; 317 | #X connect 4 0 2 1; 318 | #X connect 5 0 6 1; 319 | #X connect 5 1 2 1; 320 | #X connect 6 0 41 0; 321 | #X connect 7 0 0 0; 322 | #X connect 8 0 15 0; 323 | #X connect 9 0 40 0; 324 | #X connect 11 0 35 0; 325 | #X connect 12 0 24 0; 326 | #X connect 13 0 21 0; 327 | #X connect 14 0 6 0; 328 | #X connect 15 0 14 0; 329 | #X connect 15 1 4 0; 330 | #X connect 16 0 42 1; 331 | #X connect 17 0 7 0; 332 | #X connect 17 1 16 0; 333 | #X connect 17 2 11 0; 334 | #X connect 18 0 20 0; 335 | #X connect 19 0 3 1; 336 | #X connect 20 0 3 1; 337 | #X connect 20 1 16 1; 338 | #X connect 21 0 14 1; 339 | #X connect 21 1 42 1; 340 | #X connect 22 0 36 0; 341 | #X connect 22 1 23 0; 342 | #X connect 23 0 17 0; 343 | #X connect 24 0 14 1; 344 | #X connect 24 1 16 2; 345 | #X connect 25 0 26 0; 346 | #X connect 26 0 40 1; 347 | #X connect 30 0 40 1; 348 | #X connect 30 1 33 1; 349 | #X connect 31 0 30 0; 350 | #X connect 32 0 39 0; 351 | #X connect 33 0 37 0; 352 | #X connect 34 0 33 1; 353 | #X connect 35 0 13 0; 354 | #X connect 35 1 33 0; 355 | #X connect 35 2 27 0; 356 | #X connect 36 0 18 0; 357 | #X connect 37 0 38 0; 358 | #X connect 37 1 41 1; 359 | #X connect 38 0 41 1; 360 | #X connect 39 0 11 1; 361 | #X connect 39 1 19 0; 362 | #X connect 39 2 12 0; 363 | #X connect 39 3 31 0; 364 | #X connect 40 0 22 0; 365 | #X connect 41 0 10 0; 366 | #X connect 42 0 1 0; 367 | #X restore 199 355 pd \$0-assemble_float; 368 | #N canvas 265 108 854 599 \$0-assemble_strings 0; 369 | #X obj 231 116 inlet; 370 | #X obj 131 411 list tosymbol; 371 | #X obj 231 313 t l l; 372 | #X obj 231 291 list prepend; 373 | #X obj 131 146 inlet bang; 374 | #X obj 163 520 outlet; 375 | #X text 28 13 upper and lower case letters \, plus underscore and hyphen symbols go through. if some delimiters are ommited \, they will go through too; 376 | #X obj 131 331 list; 377 | #X obj 23 323 inlet counter; 378 | #X obj 23 429 pack f s; 379 | #X obj 23 520 outlet; 380 | #X obj 23 451 route 1 0; 381 | #X obj 163 493 symbol; 382 | #N canvas 155 167 262 222 bang_once 0; 383 | #X obj 64 91 inlet; 384 | #X obj 64 113 spigot; 385 | #X obj 64 135 t b b; 386 | #X msg 117 95 0; 387 | #X obj 64 157 outlet; 388 | #X obj 103 45 inlet reset; 389 | #X msg 103 67 1; 390 | #X connect 0 0 1 0; 391 | #X connect 1 0 2 0; 392 | #X connect 2 0 4 0; 393 | #X connect 2 1 3 0; 394 | #X connect 3 0 1 1; 395 | #X connect 5 0 6 0; 396 | #X connect 6 0 1 1; 397 | #X restore 434 283 pd bang_once; 398 | #X msg 554 308 0; 399 | #X obj 80 520 outlet; 400 | #X obj 231 169 moses 48; 401 | #X obj 304 186 moses 58; 402 | #X obj 299 76 r \$0-digits; 403 | #X msg 299 98 0; 404 | #X text 328 98 if numbers start coming in \, close [spigot]; 405 | #X obj 434 391 s \$0-symbol; 406 | #X text 433 412 if symbols start coming in \, close number's [spigot]; 407 | #X obj 535 265 t b b b; 408 | #X obj 299 120 t f f; 409 | #X msg 600 282 1; 410 | #X obj 600 364 t f f; 411 | #X obj 535 243 r \$0-delimit; 412 | #X obj 336 326 f; 413 | #X obj 354 303 r \$0-hyphen; 414 | #X obj 336 348 sel 0; 415 | #X obj 231 265 t f b b; 416 | #X obj 304 247 t f b; 417 | #X obj 131 168 t b b; 418 | #X obj 23 479 route bang; 419 | #X obj 231 138 spigot 1; 420 | #X obj 23 381 spigot 1; 421 | #X connect 0 0 35 0; 422 | #X connect 1 0 9 1; 423 | #X connect 2 0 7 1; 424 | #X connect 2 1 3 1; 425 | #X connect 3 0 2 0; 426 | #X connect 4 0 33 0; 427 | #X connect 7 0 1 0; 428 | #X connect 8 0 36 0; 429 | #X connect 9 0 11 0; 430 | #X connect 11 0 34 0; 431 | #X connect 11 1 12 0; 432 | #X connect 12 0 5 0; 433 | #X connect 13 0 21 0; 434 | #X connect 14 0 28 1; 435 | #X connect 16 0 31 0; 436 | #X connect 16 1 17 0; 437 | #X connect 17 0 32 0; 438 | #X connect 17 1 31 0; 439 | #X connect 18 0 19 0; 440 | #X connect 19 0 24 0; 441 | #X connect 23 0 13 1; 442 | #X connect 23 1 14 0; 443 | #X connect 23 2 25 0; 444 | #X connect 24 0 35 1; 445 | #X connect 24 1 36 1; 446 | #X connect 25 0 26 0; 447 | #X connect 26 0 36 1; 448 | #X connect 26 1 35 1; 449 | #X connect 27 0 23 0; 450 | #X connect 28 0 30 0; 451 | #X connect 29 0 28 1; 452 | #X connect 30 1 3 0; 453 | #X connect 31 0 3 0; 454 | #X connect 31 1 28 0; 455 | #X connect 31 2 13 0; 456 | #X connect 32 0 3 0; 457 | #X connect 32 1 28 0; 458 | #X connect 33 0 7 0; 459 | #X connect 33 1 3 1; 460 | #X connect 34 0 10 0; 461 | #X connect 34 1 15 0; 462 | #X connect 35 0 16 0; 463 | #X connect 36 0 9 0; 464 | #X restore 182 329 pd \$0-assemble_strings; 465 | #N canvas 87 82 481 287 \$0-count 0; 466 | #X obj 45 145 f; 467 | #X obj 75 145 + 1; 468 | #X msg 63 122 0; 469 | #X obj 45 169 > 0; 470 | #X obj 45 74 inlet; 471 | #X obj 45 196 outlet; 472 | #X obj 63 99 r \$0-done; 473 | #X text 49 23 this is used in case a delimiter is followed by a symbol \, so the two (or more) symbols can be diffused properly; 474 | #X connect 0 0 1 0; 475 | #X connect 0 0 3 0; 476 | #X connect 1 0 0 1; 477 | #X connect 2 0 0 1; 478 | #X connect 3 0 5 0; 479 | #X connect 4 0 0 0; 480 | #X connect 6 0 2 0; 481 | #X restore 182 302 pd \$0-count; 482 | #X obj 165 252 t b b b b; 483 | #X obj 165 275 s \$0-delimit; 484 | #X obj 47 258 s \$0-done; 485 | #X obj 297 178 sel 45; 486 | #X msg 297 200 45; 487 | #X obj 297 222 s \$0-hyphen; 488 | #X obj 330 276 t f f; 489 | #X obj 47 234 t b b b; 490 | #X obj 357 347 t b s; 491 | #X obj 93 469 route bang; 492 | #X obj 199 407 list prepend; 493 | #X obj 199 429 t l l; 494 | #X obj 268 381 r \$0-done; 495 | #X obj 114 423 r \$0-done; 496 | #X obj 66 303 t b b; 497 | #N canvas 1 82 353 268 got_bang 0; 498 | #X obj 89 97 inlet; 499 | #X obj 89 119 spigot; 500 | #X obj 89 141 outlet; 501 | #X obj 204 80 inlet; 502 | #X msg 204 102 1; 503 | #X obj 128 49 r \$0-done; 504 | #X msg 128 71 0; 505 | #X connect 0 0 1 0; 506 | #X connect 1 0 2 0; 507 | #X connect 3 0 4 0; 508 | #X connect 4 0 1 1; 509 | #X connect 5 0 6 0; 510 | #X connect 6 0 1 1; 511 | #X restore 66 347 pd got_bang; 512 | #X text 38 61 space \, comma \, and tab function as delimiters by default \, which can be set explicitly via arguments; 513 | #X connect 0 0 2 0; 514 | #X connect 2 0 20 0; 515 | #X connect 2 2 9 0; 516 | #X connect 3 0 6 0; 517 | #X connect 6 0 9 1; 518 | #X connect 6 1 9 2; 519 | #X connect 8 0 22 0; 520 | #X connect 9 0 13 0; 521 | #X connect 9 1 16 0; 522 | #X connect 10 0 23 0; 523 | #X connect 11 0 28 1; 524 | #X connect 11 1 23 0; 525 | #X connect 11 2 21 0; 526 | #X connect 12 0 11 0; 527 | #X connect 13 0 14 0; 528 | #X connect 13 1 12 0; 529 | #X connect 13 2 10 0; 530 | #X connect 13 3 11 1; 531 | #X connect 16 0 17 0; 532 | #X connect 16 1 19 0; 533 | #X connect 17 0 18 0; 534 | #X connect 19 0 11 2; 535 | #X connect 19 1 10 1; 536 | #X connect 20 0 15 0; 537 | #X connect 20 1 27 0; 538 | #X connect 20 2 13 0; 539 | #X connect 21 0 23 1; 540 | #X connect 21 1 4 0; 541 | #X connect 22 1 5 0; 542 | #X connect 23 0 24 0; 543 | #X connect 24 0 8 1; 544 | #X connect 24 1 23 1; 545 | #X connect 25 0 23 1; 546 | #X connect 26 0 8 1; 547 | #X connect 27 0 28 0; 548 | #X connect 27 1 8 0; 549 | #X connect 28 0 5 0; 550 | -------------------------------------------------------------------------------- /serial_print13.pd: -------------------------------------------------------------------------------- 1 | #N canvas 415 89 618 555 10; 2 | #X obj 47 120 inlet; 3 | #X text 374 491 written by Alexandros Drymonitis; 4 | #X obj 47 142 sel 10 13; 5 | #X obj 199 112 inlet delimiter; 6 | #X obj 384 369 outlet symbol; 7 | #X obj 66 514 outlet list; 8 | #N canvas 62 297 639 403 \$0-set_argument 0; 9 | #X obj 24 7 loadbang; 10 | #X obj 24 245 symbol \$1; 11 | #X obj 24 269 sel tab space comma any; 12 | #X obj 84 53 inlet; 13 | #X obj 372 46 symbol \$2; 14 | #X obj 24 29 t b b; 15 | #X obj 298 204 list append; 16 | #X msg 372 91 9; 17 | #X msg 415 91 32; 18 | #X obj 372 69 sel tab space comma; 19 | #X msg 458 91 44; 20 | #X msg 24 301 9; 21 | #X msg 63 301 32; 22 | #X msg 103 301 44; 23 | #X msg 142 301 9 32 44; 24 | #X msg 502 91 0; 25 | #X obj 260 120 t b s; 26 | #X obj 193 98 route bang; 27 | #X obj 193 120 t b b; 28 | #X text 189 138 if we provide one symbol only \, clear [list append] 29 | first; 30 | #X obj 298 273 outlet arg_list; 31 | #X obj 379 248 outlet num_args; 32 | #N canvas 675 248 516 378 drip_list 0; 33 | #X obj 69 60 until; 34 | #X obj 69 82 list; 35 | #X obj 69 104 list split 1; 36 | #X obj 69 14 inlet; 37 | #X obj 69 126 sel 0; 38 | #X obj 218 121 t b b; 39 | #X obj 101 149 t b f; 40 | #X obj 101 193 f; 41 | #X obj 131 193 + 1; 42 | #X obj 101 215 t f f; 43 | #X obj 218 212 f; 44 | #X obj 101 237 pack; 45 | #X obj 69 36 t b l b; 46 | #X msg 119 171 1; 47 | #X text 59 299 force a zero as the second argument if only one symbol 48 | is given via argument \, and exclude it from the list; 49 | #X obj 101 259 outlet arg_list; 50 | #X obj 218 234 outlet num_args; 51 | #X connect 0 0 1 0; 52 | #X connect 1 0 2 0; 53 | #X connect 2 0 4 0; 54 | #X connect 2 1 1 1; 55 | #X connect 2 2 5 0; 56 | #X connect 3 0 12 0; 57 | #X connect 4 1 6 0; 58 | #X connect 5 0 10 0; 59 | #X connect 5 1 0 1; 60 | #X connect 6 0 7 0; 61 | #X connect 6 1 11 1; 62 | #X connect 7 0 8 0; 63 | #X connect 7 0 9 0; 64 | #X connect 8 0 7 1; 65 | #X connect 9 0 11 0; 66 | #X connect 9 1 10 1; 67 | #X connect 10 0 16 0; 68 | #X connect 11 0 15 0; 69 | #X connect 12 0 0 0; 70 | #X connect 12 1 1 1; 71 | #X connect 12 2 13 0; 72 | #X connect 13 0 7 1; 73 | #X restore 298 227 pd drip_list; 74 | #N canvas 442 90 736 575 split_symbols 0; 75 | #X obj 34 24 inlet; 76 | #X obj 126 108 until; 77 | #X obj 126 130 list; 78 | #X obj 126 152 list split 1; 79 | #X obj 126 214 sel 32; 80 | #X obj 251 231 list prepend; 81 | #X obj 251 253 t l l; 82 | #X obj 126 236 t b b; 83 | #X obj 230 276 list; 84 | #X obj 230 298 list tosymbol; 85 | #X obj 34 47 list fromsymbol; 86 | #X obj 230 371 f; 87 | #X obj 258 371 + 1; 88 | #X msg 245 350 0; 89 | #X obj 126 86 t b l b b; 90 | #X obj 230 427 pack f s; 91 | #X obj 230 326 t b s; 92 | #X obj 230 521 outlet; 93 | #X obj 312 505 outlet; 94 | #X obj 230 449 route 0 1; 95 | #X obj 230 499 symbol; 96 | #X obj 260 472 symbol; 97 | #X obj 207 173 t b b b; 98 | #X obj 312 472 spigot; 99 | #X obj 351 450 == 0; 100 | #X obj 230 393 t f f; 101 | #X obj 34 69 route bang; 102 | #X msg 34 91 97 110 121; 103 | #X text 153 46 if we receive an empty symbol \, we'll force the list 104 | of the symbol "any"; 105 | #X text 173 211 we use space to split the two symbols; 106 | #X text 340 232 every time we output one symbol \, clear this list 107 | ; 108 | #X text 359 472 if we provide one symbol only \, send a bang out this 109 | outet; 110 | #X text 263 151 if only one symbol is received (hence \, no space) 111 | \, bang the right outlet of this subpatch explicitly \, so the symbol 112 | can pass; 113 | #X connect 0 0 10 0; 114 | #X connect 1 0 2 0; 115 | #X connect 2 0 3 0; 116 | #X connect 3 0 4 0; 117 | #X connect 3 1 2 1; 118 | #X connect 3 2 22 0; 119 | #X connect 4 0 7 0; 120 | #X connect 4 1 5 0; 121 | #X connect 5 0 6 0; 122 | #X connect 6 0 8 1; 123 | #X connect 6 1 5 1; 124 | #X connect 7 0 8 0; 125 | #X connect 7 1 5 1; 126 | #X connect 8 0 9 0; 127 | #X connect 9 0 16 0; 128 | #X connect 10 0 26 0; 129 | #X connect 11 0 12 0; 130 | #X connect 11 0 25 0; 131 | #X connect 12 0 11 1; 132 | #X connect 13 0 11 1; 133 | #X connect 14 0 1 0; 134 | #X connect 14 1 2 1; 135 | #X connect 14 2 13 0; 136 | #X connect 14 3 5 1; 137 | #X connect 15 0 19 0; 138 | #X connect 16 0 11 0; 139 | #X connect 16 1 15 1; 140 | #X connect 19 0 20 0; 141 | #X connect 19 1 21 0; 142 | #X connect 20 0 17 0; 143 | #X connect 21 0 18 0; 144 | #X connect 22 0 23 0; 145 | #X connect 22 1 8 0; 146 | #X connect 22 2 1 1; 147 | #X connect 23 0 18 0; 148 | #X connect 24 0 23 1; 149 | #X connect 25 0 15 0; 150 | #X connect 25 1 24 0; 151 | #X connect 26 0 27 0; 152 | #X connect 26 1 14 0; 153 | #X connect 27 0 14 0; 154 | #X restore 84 76 pd split_symbols; 155 | #X connect 0 0 5 0; 156 | #X connect 1 0 2 0; 157 | #X connect 2 0 11 0; 158 | #X connect 2 1 12 0; 159 | #X connect 2 2 13 0; 160 | #X connect 2 3 14 0; 161 | #X connect 2 4 14 0; 162 | #X connect 3 0 23 0; 163 | #X connect 4 0 9 0; 164 | #X connect 5 0 1 0; 165 | #X connect 5 1 4 0; 166 | #X connect 6 0 22 0; 167 | #X connect 7 0 6 1; 168 | #X connect 8 0 6 1; 169 | #X connect 9 0 7 0; 170 | #X connect 9 1 8 0; 171 | #X connect 9 2 10 0; 172 | #X connect 9 3 15 0; 173 | #X connect 10 0 6 1; 174 | #X connect 11 0 6 0; 175 | #X connect 12 0 6 0; 176 | #X connect 13 0 6 0; 177 | #X connect 14 0 6 0; 178 | #X connect 15 0 6 1; 179 | #X connect 16 0 1 0; 180 | #X connect 16 1 4 0; 181 | #X connect 17 0 18 0; 182 | #X connect 17 1 16 0; 183 | #X connect 18 0 1 0; 184 | #X connect 18 1 6 1; 185 | #X connect 22 0 20 0; 186 | #X connect 22 1 21 0; 187 | #X connect 23 0 1 1; 188 | #X connect 23 1 17 0; 189 | #X restore 199 134 pd \$0-set_argument; 190 | #X text 40 20 to be used with [comport] for utilising Arduinos' Serial.print() 191 | and Serial.println() functions; 192 | #X obj 93 447 list; 193 | #N canvas 293 276 844 259 delimiter 0; 194 | #X obj 38 176 outlet bang; 195 | #X obj 38 32 inlet; 196 | #X obj 38 56 sel; 197 | #X obj 56 79 sel; 198 | #X obj 74 101 sel; 199 | #X obj 91 39 route 1 2 3; 200 | #X obj 305 34 swap 3; 201 | #X obj 305 56 -; 202 | #X obj 305 78 t f b; 203 | #X obj 305 100 until; 204 | #X obj 305 144 f; 205 | #X obj 335 144 - 1; 206 | #X msg 323 122 3; 207 | #X obj 305 166 pack f 256; 208 | #X text 361 61 set 256 to [sel]s that are not used (if we provide one 209 | or two arguments \, for example) \, cause this number will never go 210 | through [comport] (it's 8-bits plus 1); 211 | #X obj 129 118 outlet through; 212 | #X obj 91 17 inlet arg_list; 213 | #X obj 305 12 inlet num_args; 214 | #X connect 1 0 2 0; 215 | #X connect 2 0 0 0; 216 | #X connect 2 1 3 0; 217 | #X connect 3 0 0 0; 218 | #X connect 3 1 4 0; 219 | #X connect 4 0 0 0; 220 | #X connect 4 1 15 0; 221 | #X connect 5 0 2 1; 222 | #X connect 5 1 3 1; 223 | #X connect 5 2 4 1; 224 | #X connect 6 0 7 0; 225 | #X connect 6 1 7 1; 226 | #X connect 7 0 8 0; 227 | #X connect 8 0 9 0; 228 | #X connect 8 1 12 0; 229 | #X connect 9 0 10 0; 230 | #X connect 10 0 11 0; 231 | #X connect 10 0 13 0; 232 | #X connect 11 0 10 1; 233 | #X connect 12 0 10 1; 234 | #X connect 13 0 5 0; 235 | #X connect 16 0 5 0; 236 | #X connect 17 0 6 0; 237 | #X restore 165 160 pd delimiter; 238 | #N canvas 372 82 841 654 \$0-assemble_float 0; 239 | #X obj 103 366 t f b; 240 | #X obj 103 457 +; 241 | #X obj 135 393 f; 242 | #X obj 135 440 * 10; 243 | #X msg 153 233 0; 244 | #X obj 103 479 t f f; 245 | #X obj 21 496 f; 246 | #X obj 103 343 - 48; 247 | #X obj 21 194 inlet get; 248 | #X obj 201 63 inlet val; 249 | #X obj 21 584 outlet; 250 | #N canvas 155 167 262 222 bang_once 0; 251 | #X obj 64 91 inlet; 252 | #X obj 64 113 spigot; 253 | #X obj 64 135 t b b; 254 | #X msg 117 96 0; 255 | #X obj 64 157 outlet; 256 | #X obj 103 45 inlet reset; 257 | #X msg 103 67 1; 258 | #X connect 0 0 1 0; 259 | #X connect 1 0 2 0; 260 | #X connect 2 0 4 0; 261 | #X connect 2 1 3 0; 262 | #X connect 3 0 1 1; 263 | #X connect 5 0 6 0; 264 | #X connect 6 0 1 1; 265 | #X restore 300 229 pd bang_once; 266 | #X msg 436 234 0; 267 | #X msg 300 299 1; 268 | #X obj 21 338 spigot; 269 | #X obj 21 216 t b b; 270 | #N canvas 386 453 292 235 set_decimal_place 0; 271 | #X obj 36 26 inlet; 272 | #X obj 66 104 + 1; 273 | #X obj 36 126 swap 10; 274 | #X obj 36 148 pow; 275 | #X obj 36 193 outlet; 276 | #X obj 36 104 f; 277 | #X obj 36 71 spigot; 278 | #X obj 122 32 inlet; 279 | #X obj 122 54 t f f; 280 | #X obj 75 46 inlet; 281 | #X obj 36 170 pow -1; 282 | #X connect 0 0 6 0; 283 | #X connect 1 0 5 1; 284 | #X connect 2 0 3 0; 285 | #X connect 2 1 3 1; 286 | #X connect 3 0 10 0; 287 | #X connect 5 0 1 0; 288 | #X connect 5 0 2 0; 289 | #X connect 6 0 5 0; 290 | #X connect 7 0 8 0; 291 | #X connect 8 0 6 1; 292 | #X connect 8 1 5 0; 293 | #X connect 9 0 6 1; 294 | #X connect 10 0 4 0; 295 | #X restore 277 372 pd set_decimal_place; 296 | #X obj 254 201 t f b b; 297 | #X msg 201 401 1; 298 | #X msg 160 418 10; 299 | #X obj 201 423 t f f; 300 | #X obj 300 321 t f f; 301 | #X obj 201 115 moses 48; 302 | #X obj 254 137 moses 58; 303 | #X obj 436 256 t f f; 304 | #X obj 291 51 r \$0-symbol; 305 | #X msg 291 73 0; 306 | #X obj 356 282 s \$0-digits; 307 | #X text 426 284 if digits start coming in \, close symbol's [spigot] 308 | ; 309 | #X text 326 74 if symbols start coming in \, close [spigot] so that 310 | the symbol can also contain digits; 311 | #X obj 483 251 t f f; 312 | #X msg 483 229 1; 313 | #X obj 396 190 r \$0-delimit; 314 | #X obj 323 480 f; 315 | #X obj 341 457 r \$0-hyphen; 316 | #X obj 300 265 t b b b; 317 | #X obj 201 162 sel 46; 318 | #X obj 323 502 sel 45; 319 | #X msg 323 544 -1; 320 | #X obj 396 212 t b b b b; 321 | #X obj 201 90 spigot 1; 322 | #X obj 21 561 * 1; 323 | #X obj 103 389 * 1; 324 | #X connect 0 0 42 0; 325 | #X connect 0 1 2 0; 326 | #X connect 1 0 5 0; 327 | #X connect 2 0 3 0; 328 | #X connect 3 0 1 1; 329 | #X connect 4 0 2 1; 330 | #X connect 5 0 6 1; 331 | #X connect 5 1 2 1; 332 | #X connect 6 0 41 0; 333 | #X connect 7 0 0 0; 334 | #X connect 8 0 15 0; 335 | #X connect 9 0 40 0; 336 | #X connect 11 0 35 0; 337 | #X connect 12 0 24 0; 338 | #X connect 13 0 21 0; 339 | #X connect 14 0 6 0; 340 | #X connect 15 0 14 0; 341 | #X connect 15 1 4 0; 342 | #X connect 16 0 42 1; 343 | #X connect 17 0 7 0; 344 | #X connect 17 1 16 0; 345 | #X connect 17 2 11 0; 346 | #X connect 18 0 20 0; 347 | #X connect 19 0 3 1; 348 | #X connect 20 0 3 1; 349 | #X connect 20 1 16 1; 350 | #X connect 21 0 14 1; 351 | #X connect 21 1 42 1; 352 | #X connect 22 0 36 0; 353 | #X connect 22 1 23 0; 354 | #X connect 23 0 17 0; 355 | #X connect 24 0 14 1; 356 | #X connect 24 1 16 2; 357 | #X connect 25 0 26 0; 358 | #X connect 26 0 40 1; 359 | #X connect 30 0 40 1; 360 | #X connect 30 1 33 1; 361 | #X connect 31 0 30 0; 362 | #X connect 32 0 39 0; 363 | #X connect 33 0 37 0; 364 | #X connect 34 0 33 1; 365 | #X connect 35 0 13 0; 366 | #X connect 35 1 33 0; 367 | #X connect 35 2 27 0; 368 | #X connect 36 0 18 0; 369 | #X connect 37 0 38 0; 370 | #X connect 37 1 41 1; 371 | #X connect 38 0 41 1; 372 | #X connect 39 0 11 1; 373 | #X connect 39 1 19 0; 374 | #X connect 39 2 12 0; 375 | #X connect 39 3 31 0; 376 | #X connect 40 0 22 0; 377 | #X connect 41 0 10 0; 378 | #X connect 42 0 1 0; 379 | #X restore 199 355 pd \$0-assemble_float; 380 | #N canvas 265 108 854 599 \$0-assemble_strings 0; 381 | #X obj 231 116 inlet; 382 | #X obj 131 412 list tosymbol; 383 | #X obj 231 313 t l l; 384 | #X obj 231 291 list prepend; 385 | #X obj 131 146 inlet bang; 386 | #X obj 163 520 outlet; 387 | #X text 28 13 upper and lower case letters \, plus underscore and hyphen 388 | symbols go through. if some delimiters are ommited \, they will go 389 | through too; 390 | #X obj 131 330 list; 391 | #X obj 23 323 inlet counter; 392 | #X obj 23 429 pack f s; 393 | #X obj 23 520 outlet; 394 | #X obj 23 451 route 1 0; 395 | #X obj 163 493 symbol; 396 | #N canvas 155 167 262 222 bang_once 0; 397 | #X obj 64 91 inlet; 398 | #X obj 64 113 spigot; 399 | #X obj 64 135 t b b; 400 | #X msg 117 96 0; 401 | #X obj 64 157 outlet; 402 | #X obj 103 45 inlet reset; 403 | #X msg 103 67 1; 404 | #X connect 0 0 1 0; 405 | #X connect 1 0 2 0; 406 | #X connect 2 0 4 0; 407 | #X connect 2 1 3 0; 408 | #X connect 3 0 1 1; 409 | #X connect 5 0 6 0; 410 | #X connect 6 0 1 1; 411 | #X restore 434 282 pd bang_once; 412 | #X msg 558 309 0; 413 | #X obj 90 520 outlet; 414 | #X obj 231 169 moses 48; 415 | #X obj 304 186 moses 58; 416 | #X obj 299 77 r \$0-digits; 417 | #X msg 299 99 0; 418 | #X text 328 99 if numbers start coming in \, close [spigot]; 419 | #X obj 434 391 s \$0-symbol; 420 | #X text 433 412 if symbols start coming in \, close number's [spigot] 421 | ; 422 | #X obj 535 265 t b b b; 423 | #X obj 299 121 t f f; 424 | #X msg 600 282 1; 425 | #X obj 600 364 t f f; 426 | #X obj 535 243 r \$0-delimit; 427 | #X obj 336 326 f; 428 | #X obj 354 303 r \$0-hyphen; 429 | #X obj 336 348 sel 0; 430 | #X obj 231 265 t f b b; 431 | #X obj 304 247 t f b; 432 | #X obj 131 168 t b b; 433 | #X obj 23 479 route bang; 434 | #X obj 231 138 spigot 1; 435 | #X obj 23 381 spigot 1; 436 | #X connect 0 0 35 0; 437 | #X connect 1 0 9 1; 438 | #X connect 2 0 7 1; 439 | #X connect 2 1 3 1; 440 | #X connect 3 0 2 0; 441 | #X connect 4 0 33 0; 442 | #X connect 7 0 1 0; 443 | #X connect 8 0 36 0; 444 | #X connect 9 0 11 0; 445 | #X connect 11 0 34 0; 446 | #X connect 11 1 12 0; 447 | #X connect 12 0 5 0; 448 | #X connect 13 0 21 0; 449 | #X connect 14 0 28 1; 450 | #X connect 16 0 31 0; 451 | #X connect 16 1 17 0; 452 | #X connect 17 0 32 0; 453 | #X connect 17 1 31 0; 454 | #X connect 18 0 19 0; 455 | #X connect 19 0 24 0; 456 | #X connect 23 0 13 1; 457 | #X connect 23 1 14 0; 458 | #X connect 23 2 25 0; 459 | #X connect 24 0 35 1; 460 | #X connect 24 1 36 1; 461 | #X connect 25 0 26 0; 462 | #X connect 26 0 36 1; 463 | #X connect 26 1 35 1; 464 | #X connect 27 0 23 0; 465 | #X connect 28 0 30 0; 466 | #X connect 29 0 28 1; 467 | #X connect 30 1 3 0; 468 | #X connect 31 0 3 0; 469 | #X connect 31 1 28 0; 470 | #X connect 31 2 13 0; 471 | #X connect 32 0 3 0; 472 | #X connect 32 1 28 0; 473 | #X connect 33 0 7 0; 474 | #X connect 33 1 3 1; 475 | #X connect 34 0 10 0; 476 | #X connect 34 1 15 0; 477 | #X connect 35 0 16 0; 478 | #X connect 36 0 9 0; 479 | #X restore 182 328 pd \$0-assemble_strings; 480 | #N canvas 87 82 481 287 \$0-count 0; 481 | #X obj 45 145 f; 482 | #X obj 75 145 + 1; 483 | #X msg 63 122 0; 484 | #X obj 45 169 > 0; 485 | #X obj 45 74 inlet; 486 | #X obj 45 196 outlet; 487 | #X obj 63 99 r \$0-done; 488 | #X text 49 23 this is used in case a delimiter is followed by a symbol 489 | \, so the two (or more) symbols can be diffused properly; 490 | #X connect 0 0 1 0; 491 | #X connect 0 0 3 0; 492 | #X connect 1 0 0 1; 493 | #X connect 2 0 0 1; 494 | #X connect 3 0 5 0; 495 | #X connect 4 0 0 0; 496 | #X connect 6 0 2 0; 497 | #X restore 182 301 pd \$0-count; 498 | #X obj 165 252 t b b b b; 499 | #X obj 165 275 s \$0-delimit; 500 | #X obj 47 258 s \$0-done; 501 | #X obj 278 178 sel 45; 502 | #X msg 278 200 45; 503 | #X obj 278 222 s \$0-hyphen; 504 | #X obj 311 277 t f f; 505 | #X obj 47 234 t b b b; 506 | #X obj 357 346 t b s; 507 | #X obj 93 469 route bang; 508 | #X obj 199 407 list prepend; 509 | #X obj 199 429 t l l; 510 | #X obj 268 381 r \$0-done; 511 | #X obj 114 423 r \$0-done; 512 | #X obj 66 303 t b b; 513 | #N canvas 1 82 353 268 got_bang 0; 514 | #X obj 89 97 inlet; 515 | #X obj 89 119 spigot; 516 | #X obj 89 141 outlet; 517 | #X obj 204 80 inlet; 518 | #X msg 204 102 1; 519 | #X obj 128 49 r \$0-done; 520 | #X msg 128 71 0; 521 | #X connect 0 0 1 0; 522 | #X connect 1 0 2 0; 523 | #X connect 3 0 4 0; 524 | #X connect 4 0 1 1; 525 | #X connect 5 0 6 0; 526 | #X connect 6 0 1 1; 527 | #X restore 66 346 pd got_bang; 528 | #X text 38 61 space \, comma \, and tab function as delimiters by default 529 | \, which can be set explicitly via arguments; 530 | #N canvas 1 82 450 300 debounce13 0; 531 | #X text 37 15 13 goes through as 10 \, so we're receiving two times 532 | 10; 533 | #X obj 45 58 inlet; 534 | #X obj 45 81 t b b; 535 | #X obj 127 99 f; 536 | #X obj 157 101 + 1; 537 | #X msg 142 73 0; 538 | #X obj 45 117 spigot; 539 | #X obj 45 140 t b b b; 540 | #X msg 64 163 0; 541 | #X obj 45 199 outlet; 542 | #X connect 1 0 2 0; 543 | #X connect 2 0 6 0; 544 | #X connect 2 1 3 0; 545 | #X connect 3 0 4 0; 546 | #X connect 3 0 6 1; 547 | #X connect 4 0 3 1; 548 | #X connect 5 0 3 1; 549 | #X connect 6 0 7 0; 550 | #X connect 7 0 9 0; 551 | #X connect 7 1 8 0; 552 | #X connect 7 2 5 0; 553 | #X connect 8 0 6 1; 554 | #X restore 47 185 pd debounce13; 555 | #X connect 0 0 2 0; 556 | #X connect 2 0 30 0; 557 | #X connect 2 2 9 0; 558 | #X connect 3 0 6 0; 559 | #X connect 6 0 9 1; 560 | #X connect 6 1 9 2; 561 | #X connect 8 0 22 0; 562 | #X connect 9 0 13 0; 563 | #X connect 9 1 16 0; 564 | #X connect 10 0 23 0; 565 | #X connect 11 0 28 1; 566 | #X connect 11 1 23 0; 567 | #X connect 11 2 21 0; 568 | #X connect 12 0 11 0; 569 | #X connect 13 0 14 0; 570 | #X connect 13 1 12 0; 571 | #X connect 13 2 10 0; 572 | #X connect 13 3 11 1; 573 | #X connect 16 0 17 0; 574 | #X connect 16 1 19 0; 575 | #X connect 17 0 18 0; 576 | #X connect 19 0 11 2; 577 | #X connect 19 1 10 1; 578 | #X connect 20 0 15 0; 579 | #X connect 20 1 27 0; 580 | #X connect 20 2 13 0; 581 | #X connect 21 0 23 1; 582 | #X connect 21 1 4 0; 583 | #X connect 22 1 5 0; 584 | #X connect 23 0 24 0; 585 | #X connect 24 0 8 1; 586 | #X connect 24 1 23 1; 587 | #X connect 25 0 23 1; 588 | #X connect 26 0 8 1; 589 | #X connect 27 0 28 0; 590 | #X connect 27 1 8 0; 591 | #X connect 28 0 5 0; 592 | #X connect 30 0 20 0; 593 | --------------------------------------------------------------------------------