aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pd_firmware/Pd_firmware.pde180
-rw-r--r--arduino-help.pd110
-rw-r--r--arduino-test.pd485
-rw-r--r--arduino.pd222
4 files changed, 523 insertions, 474 deletions
diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde
index 392fb05..b0c1056 100644
--- a/Pd_firmware/Pd_firmware.pde
+++ b/Pd_firmware/Pd_firmware.pde
@@ -28,20 +28,30 @@
* used with other programs like Max/MSP, Processing, or whatever can
* do serial communications.
*
- * @authors: Hans-Christoph Steiner <hans@at.or.at> and Jamie Allen <jamie@heavyside.net>
+ * @authors: Hans-Christoph Steiner <hans@at.or.at>
+ * help with protocol redesign: Jamie Allen <jamie@heavyside.net>
+ * key bugfixes: Georg Holzmann <grh@mur.at>
+ * Gerda Strobl <gerda.strobl@student.tugraz.at>
* @date: 2006-05-19
- * @location: STEIM, Amsterdam, Netherlands and New York, NY
- *
+ * @locations: STEIM, Amsterdam, Netherlands
+ * IDMI/Polytechnic University, Brookyn, NY, USA
+ * Electrolobby Ars Electronica, Linz, Austria
*/
/*
- * TODO: get digitalInput working
* TODO: add pulseIn functionality
* TODO: add software PWM for servos, etc (servo.h or pulse.h)
* TODO: redesign protocol to accomodate boards with more I/Os
+ * TODO:
+ * TODO: add "outputMode all 0/1" command
* TODO: add cycle markers to mark start of analog, digital, pulseIn, and PWM
*/
+/* firmware version numbers. The protocol is still changing, so these version
+ * numbers are important */
+#define MAJOR_VERSION 0
+#define MINOR_VERSION 1
+
/* firmata protocol
* ===============
* data: 0-127
@@ -69,13 +79,13 @@
#define DISABLE_DIGITAL_INPUTS 150 // disable reporting of digital inputs
#define ENABLE_DIGITAL_INPUTS 151 // enable reporting of digital inputs
/* 152-159 // UNUSED */
-#define DISABLE_ALL_ANALOG_INS 160 // disable reporting on all analog ins
-#define ENABLE_ONE_ANALOG_IN 161 // enable reporting for 1 analog in (0)
-#define ENABLE_TWO_ANALOG_INS 162 // enable reporting for 2 analog ins (0,1)
-#define ENABLE_THREE_ANALOG_INS 163 // enable reporting for 3 analog ins (0-2)
-#define ENABLE_FOUR_ANALOG_INS 164 // enable reporting for 4 analog ins (0-3)
-#define ENABLE_FIVE_ANALOG_INS 165 // enable reporting for 5 analog ins (0-4)
-#define ENABLE_SIX_ANALOG_INS 166 // enable reporting for 6 analog ins (0-5)
+#define ZERO_ANALOG_INS 160 // disable reporting on all analog ins
+#define ONE_ANALOG_IN 161 // enable reporting for 1 analog in (0)
+#define TWO_ANALOG_INS 162 // enable reporting for 2 analog ins (0,1)
+#define THREE_ANALOG_INS 163 // enable reporting for 3 analog ins (0-2)
+#define FOUR_ANALOG_INS 164 // enable reporting for 4 analog ins (0-3)
+#define FIVE_ANALOG_INS 165 // enable reporting for 5 analog ins (0-4)
+#define SIX_ANALOG_INS 166 // enable reporting for 6 analog ins (0-5)
/* 167-199 // UNUSED */
#define SET_PIN_ZERO_TO_OUT 200 // set digital pin 0 to OUTPUT
#define SET_PIN_ONE_TO_OUT 201 // set digital pin 1 to OUTPUT
@@ -93,21 +103,22 @@
#define SET_PIN_THIRTEEN_TO_OUT 213 // set digital pin 13 to OUTPUT
/* 214-228 // UNUSED */
#define OUTPUT_TO_DIGITAL_PINS 229 // next two bytes set digital output data
-/* 230-249 // UNUSED */
+/* 230-239 // UNUSED */
+#define REPORT_VERSION 240 // return the firmware version
+/* 240-249 // UNUSED */
#define DISABLE_PWM 250 // next byte sets pin # to disable
#define ENABLE_PWM 251 // next two bytes set pin # and duty cycle
#define DISABLE_SOFTWARE_PWM 252 // next byte sets pin # to disable
#define ENABLE_SOFTWARE_PWM 253 // next two bytes set pin # and duty cycle
#define SET_SOFTWARE_PWM_FREQ 254 // set master frequency for software PWMs
-/* 252-254 // UNUSED */
-#define INPUT_CYCLE_MARKER 255 // input cycle marker
+/* 255 // UNUSED */
/* two byte digital output data format
* ----------------------
* 0 get ready for digital input bytes (229)
- * 1 digitalOut 0-6 bitmask
- * 2 digitalOut 7-13 bitmask
+ * 1 digitalOut 7-13 bitmask
+ * 2 digitalOut 0-6 bitmask
*/
/* two byte PWM data format
@@ -117,31 +128,34 @@
* 2 duty cycle expressed as 1 byte (255 = 100%)
*/
-
-/* Arduino->Computer byte cycle
+/* digital input message format
+ * ----------------------
+ * 0 digital input marker (255/11111111)
+ * 1 digital read from Arduino // 7-13 bitmask
+ * 2 digital read from Arduino // 0-6 bitmask
+ */
+
+/* analog input message format
* ----------------------
- * 0 start of cycle marker (255/11111111)
- * 1 digital read from Arduino // 0-6 bitmask
- * 2 digital read from Arduino // 7-13 bitmask
- * 3 low byte from analog input pin 0
- * 4 high byte from analog input pin 0
- * 5 low byte from analog input pin 1
- * 6 high byte from analog input pin 1
- * 7 low byte from analog input pin 2
- * 8 high byte from analog input pin 2
- * 9 low byte from analog input pin 3
- * 10 high byte from analog input pin 3
- * 11 low byte from analog input pin 4
- * 12 high byte from analog input pin 4
- * 13 low byte from analog input pin 5
- * 14 high byte from analog input pin 5
+ * 0 analog input marker
+ * 1 high byte from analog input pin 0
+ * 2 low byte from analog input pin 0
+ * 3 high byte from analog input pin 1
+ * 4 low byte from analog input pin 1
+ * 5 high byte from analog input pin 2
+ * 6 low byte from analog input pin 2
+ * 7 high byte from analog input pin 3
+ * 8 low byte from analog input pin 3
+ * 9 high byte from analog input pin 4
+ * 10 low byte from analog input pin 4
+ * 11 high byte from analog input pin 5
+ * 12 low byte from analog input pin 5
*/
#define TOTAL_DIGITAL_PINS 14
// for comparing along with INPUT and OUTPUT
#define PWM 2
-#define SOFTPWM 3
// maximum number of post-command data bytes
#define MAX_DATA_BYTES 2
@@ -185,13 +199,13 @@ void transmitDigitalInput(byte startPin) {
for(i=0;i<7;++i) {
digitalPin = i+startPin;
/* digitalPinBit = OUTPUT << digitalPin;
- // only read the pin if its set to input
- if(digitalPinStatus & digitalPinBit) {
- digitalData = 0; // pin set to OUTPUT, don't read
- }
- else if( (digitalPin >= 9) && (pwmStatus & (1 << digitalPin)) ) {
- digitalData = 0; // pin set to PWM, don't read
- }*/
+// only read the pin if its set to input
+if(digitalPinStatus & digitalPinBit) {
+digitalData = 0; // pin set to OUTPUT, don't read
+}
+else if( (digitalPin >= 9) && (pwmStatus & (1 << digitalPin)) ) {
+digitalData = 0; // pin set to PWM, don't read
+}*/
if( !(digitalPinStatus & (1 << digitalPin)) ) {
digitalData = (byte) digitalRead(digitalPin);
transmitByte = transmitByte + ((1 << i) * digitalData);
@@ -220,25 +234,18 @@ void setPinMode(int pin, int mode) {
else if( (mode == PWM) && (pin >= 9) && (pin <= 11) ) {
digitalPinStatus = digitalPinStatus | (1 << pin);
pwmStatus = pwmStatus | (1 << pin);
- softPwmStatus = softPwmStatus &~ (1 << pin);
pinMode(pin,OUTPUT);
}
- else if(mode == SOFTPWM) {
- digitalPinStatus = digitalPinStatus | (1 << pin);
- pwmStatus = pwmStatus &~ (1 << pin);
- softPwmStatus = softPwmStatus | (1 << pin);
- pinMode(pin,OUTPUT);
- }
}
void setSoftPwm (int pin, byte pulsePeriod) {
byte i;
/* for(i=0; i<7; ++i) {
- mask = 1 << i;
- if(digitalPinStatus & mask) {
- digitalWrite(i, inputData & mask);
- }
- }
+ mask = 1 << i;
+ if(digitalPinStatus & mask) {
+ digitalWrite(i, inputData & mask);
+ }
+ }
*/
//read timer type thing
@@ -294,7 +301,7 @@ void processInput(byte inputData) {
setPinMode(storedInputData[0],INPUT);
break;
case ENABLE_SOFTWARE_PWM:
- setPinMode(storedInputData[1],SOFTPWM);
+ setPinMode(storedInputData[1],PWM);
setSoftPwm(storedInputData[1], storedInputData[0]);
break;
case DISABLE_SOFTWARE_PWM:
@@ -308,24 +315,24 @@ void processInput(byte inputData) {
}
}
else if(inputData < 128) {
- if(firstInputByte) { //
- for(i=0; i<7; ++i) {
- mask = 1 << i;
- if(digitalPinStatus & mask) {
- digitalWrite(i, inputData & mask);
- }
- }
- firstInputByte = false;
- }
- else { //
+ if(firstInputByte) {
// output data for pins 7-13
for(i=7; i<TOTAL_DIGITAL_PINS; ++i) {
mask = 1 << i;
- if( (digitalPinStatus & mask) && !(pwmStatus & mask) && !(softPwmStatus & mask) ) {
+ if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) {
// inputData is a byte and mask is an int, so align the high part of mask
digitalWrite(i, inputData & (mask >> 7));
}
}
+ firstInputByte = false;
+ }
+ else { //
+ for(i=0; i<7; ++i) {
+ mask = 1 << i;
+ if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) {
+ digitalWrite(i, inputData & mask);
+ }
+ }
}
}
else {
@@ -368,14 +375,14 @@ void processInput(byte inputData) {
case ENABLE_DIGITAL_INPUTS: // all digital inputs on
digitalInputsEnabled = true;
break;
- case DISABLE_ALL_ANALOG_INS: // analog input off
- case ENABLE_ONE_ANALOG_IN: // analog 0 on
- case ENABLE_TWO_ANALOG_INS: // analog 0,1 on
- case ENABLE_THREE_ANALOG_INS: // analog 0-2 on
- case ENABLE_FOUR_ANALOG_INS: // analog 0-3 on
- case ENABLE_FIVE_ANALOG_INS: // analog 0-4 on
- case ENABLE_SIX_ANALOG_INS: // analog 0-5 on
- analogInputsEnabled = inputData - DISABLE_ALL_ANALOG_INS;
+ case ZERO_ANALOG_INS: // analog input off
+ case ONE_ANALOG_IN: // analog 0 on
+ case TWO_ANALOG_INS: // analog 0,1 on
+ case THREE_ANALOG_INS: // analog 0-2 on
+ case FOUR_ANALOG_INS: // analog 0-3 on
+ case FIVE_ANALOG_INS: // analog 0-4 on
+ case SIX_ANALOG_INS: // analog 0-5 on
+ analogInputsEnabled = inputData - ZERO_ANALOG_INS;
break;
case ENABLE_PWM:
waitForData = 2; // 2 bytes needed (pin#, dutyCycle)
@@ -400,6 +407,11 @@ void processInput(byte inputData) {
case OUTPUT_TO_DIGITAL_PINS: // bytes to send to digital outputs
firstInputByte = true;
break;
+ case REPORT_VERSION:
+ printByte(REPORT_VERSION);
+ printByte(MAJOR_VERSION);
+ printByte(MINOR_VERSION);
+ break;
}
}
}
@@ -423,31 +435,21 @@ void loop() {
// read all digital pins, in enabled
if(digitalInputsEnabled) {
- transmitDigitalInput(0);
- checkForInput();
+ printByte(ENABLE_DIGITAL_INPUTS);
transmitDigitalInput(7);
checkForInput();
- }
- else if(analogInputsEnabled) {
- // filler bytes, since the first thing sent is always the digitalInputs
- printByte(0);
- printByte(0);
- checkForInput();
+ transmitDigitalInput(0);
+ checkForInput();
}
- /* get analog in, for the number enabled
- */
+ /* get analog in, for the number enabled */
for(analogPin=0; analogPin<analogInputsEnabled; ++analogPin) {
analogData = analogRead(analogPin);
// these two bytes get converted back into the whole number in Pd
// the higher bits should be zeroed so that the 8th bit doesn't get set
- printByte(analogData % 128); // mod by 32 for the small byte
+ printByte(ONE_ANALOG_IN + analogPin);
printByte(analogData >> 7); // bitshift the big stuff into the output byte
+ printByte(analogData % 128); // mod by 32 for the small byte
checkForInput();
}
-
- /* end with the cycle marker, if any of the inputs are enabled */
- if( digitalInputsEnabled || analogInputsEnabled) {
- printByte(255);
- }
}
diff --git a/arduino-help.pd b/arduino-help.pd
index df8708e..c4af6ed 100644
--- a/arduino-help.pd
+++ b/arduino-help.pd
@@ -1,5 +1,5 @@
-#N canvas 654 0 691 634 10;
-#N canvas 233 472 450 300 INSTALL-NOTES 0;
+#N canvas 62 23 698 571 10;
+#N canvas 233 472 454 304 INSTALL-NOTES 0;
#X text 39 201 [comport] \, from pd-cvs/externals/iem/comport;
#X text 39 185 [arduino] \, from pd-cvs/externals/hardware/arduino
;
@@ -15,18 +15,18 @@ board !;
;
#X text 22 257 5 If you still have troubles \, mail to the pd list
!;
-#X restore 25 136 pd INSTALL-NOTES;
-#X text 150 137 <- read this first !;
-#X obj 402 134 arduino 5;
-#X obj 26 244 hradio 15 1 0 8 empty empty empty 0 -6 0 8 -260818 -1
--1 5;
-#X msg 26 262 open \$1;
-#X floatatom 109 261 5 0 0 0 - - -;
-#X obj 402 113 r \$0-arduino;
-#X msg 37 283 close;
-#X msg 47 304 info;
-#X text 21 221 select/close the serial port:;
-#X obj 26 326 s \$0-arduino;
+#X restore 25 92 pd INSTALL-NOTES;
+#X text 150 93 <- read this first !;
+#X obj 402 90 arduino 5;
+#X obj 26 180 hradio 15 1 0 8 empty empty empty 0 -6 0 8 -260818 -1
+-1 0;
+#X msg 26 198 open \$1;
+#X floatatom 109 197 5 0 0 0 - - -;
+#X obj 402 69 r \$0-arduino;
+#X msg 37 219 close;
+#X msg 47 240 info;
+#X text 21 157 select/close the serial port:;
+#X obj 26 262 s \$0-arduino;
#N canvas 728 223 550 248 DIGITAL-OUTPUT 0;
#X text 21 78 I/O the individual pins:;
#X obj 42 118 tgl 15 0 empty empty 1 3 -6 0 10 -260818 -1 -1 0 1;
@@ -46,7 +46,7 @@ board !;
;
#X obj 264 118 tgl 15 0 empty empty 13 3 -6 0 10 -260818 -1 -1 0 1
;
-#X obj 284 98 tgl 20 0 empty empty empty 0 -6 0 8 -258699 -1 -1 1 1
+#X obj 284 98 tgl 20 0 empty empty empty 0 -6 0 8 -258699 -1 -1 0 1
;
#X obj 24 118 tgl 15 0 empty empty 0 3 -6 0 10 -260818 -1 -1 0 1;
#N canvas 688 388 650 300 send-to-arduino................. 0;
@@ -268,7 +268,7 @@ you have to convert the binary toggle to a decimal number;
#X connect 15 0 16 0;
#X connect 16 0 17 0;
#X connect 16 0 18 0;
-#X restore 171 502 pd DIGITAL-OUTPUT;
+#X restore 171 438 pd DIGITAL-OUTPUT;
#N canvas 494 94 550 252 DIGITAL-INPUT 0;
#X obj 46 128 tgl 15 0 empty empty 1 3 -6 0 10 -260818 -1 -1 0 2;
#X obj 64 128 tgl 15 0 empty empty 2 3 -6 0 10 -260818 -1 -1 0 4;
@@ -293,7 +293,7 @@ you have to convert the binary toggle to a decimal number;
;
#X obj 267 128 tgl 15 0 empty empty 13 3 -6 0 10 -260818 -1 -1 0 8192
;
-#X obj 28 128 tgl 15 0 empty empty 0 3 -6 0 10 -260818 -1 -1 1 1;
+#X obj 28 128 tgl 15 0 empty empty 0 3 -6 0 10 -260818 -1 -1 0 1;
#N canvas 64 160 778 300 send-to-arduino................. 0;
#X obj 35 55 route digital;
#X obj 35 229 outlet;
@@ -379,30 +379,30 @@ to the ground \, you will get random values (0 or 1) - to avoid that
#X connect 14 12 11 0;
#X connect 14 13 12 0;
#X connect 15 0 14 0;
-#X restore 178 478 pd DIGITAL-INPUT;
-#X obj 402 155 s \$0-arduino-out;
-#X text 525 303 (0=input \, 1=output);
-#X obj 289 276 tgl 15 0 empty empty 1 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 307 276 tgl 15 0 empty empty 2 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 325 276 tgl 15 0 empty empty 3 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 343 276 tgl 15 0 empty empty 4 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 361 276 tgl 15 0 empty empty 5 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 379 276 tgl 15 0 empty empty 6 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 397 276 tgl 15 0 empty empty 7 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 415 276 tgl 15 0 empty empty 8 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 433 276 tgl 15 0 empty empty 9 3 -6 0 10 -260818 -1 -1 1 1;
-#X obj 451 276 tgl 15 0 empty empty 10 3 -6 0 10 -260818 -1 -1 1 1
+#X restore 178 414 pd DIGITAL-INPUT;
+#X obj 402 111 s \$0-arduino-out;
+#X text 525 239 (0=input \, 1=output);
+#X obj 289 212 tgl 15 0 empty empty 1 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 307 212 tgl 15 0 empty empty 2 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 325 212 tgl 15 0 empty empty 3 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 343 212 tgl 15 0 empty empty 4 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 361 212 tgl 15 0 empty empty 5 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 379 212 tgl 15 0 empty empty 6 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 397 212 tgl 15 0 empty empty 7 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 415 212 tgl 15 0 empty empty 8 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 433 212 tgl 15 0 empty empty 9 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 451 212 tgl 15 0 empty empty 10 3 -6 0 10 -260818 -1 -1 0 1
;
-#X obj 469 276 tgl 15 0 empty empty 11 3 -6 0 10 -260818 -1 -1 1 1
+#X obj 469 212 tgl 15 0 empty empty 11 3 -6 0 10 -260818 -1 -1 0 1
;
-#X obj 487 276 tgl 15 0 empty empty 12 3 -6 0 10 -260818 -1 -1 1 1
+#X obj 487 212 tgl 15 0 empty empty 12 3 -6 0 10 -260818 -1 -1 0 1
;
-#X obj 505 276 tgl 15 0 empty empty 13 3 -6 0 10 -260818 -1 -1 1 1
+#X obj 505 212 tgl 15 0 empty empty 13 3 -6 0 10 -260818 -1 -1 0 1
;
-#X obj 531 256 tgl 20 0 empty empty empty 0 -6 0 8 -258699 -1 -1 1
+#X obj 531 192 tgl 20 0 empty empty empty 0 -6 0 8 -258699 -1 -1 0
1;
-#X text 530 241 all;
-#X obj 271 276 tgl 15 0 empty empty 0 3 -6 0 10 -260818 -1 -1 1 1;
+#X text 530 177 all;
+#X obj 271 212 tgl 15 0 empty empty 0 3 -6 0 10 -260818 -1 -1 0 1;
#N canvas 554 328 750 300 send-to-arduino---------------- 0;
#X obj 49 54 inlet;
#X obj 89 54 inlet;
@@ -461,11 +461,11 @@ to the ground \, you will get random values (0 or 1) - to avoid that
#X connect 25 0 28 0;
#X connect 26 0 27 0;
#X connect 27 0 28 0;
-#X restore 271 303 pd send-to-arduino----------------;
-#X obj 271 356 s \$0-arduino;
-#X msg 294 329 outputMode 13 1;
-#X text 412 329 set pin 13 to output mode;
-#X text 270 223 Set input/output mode of the pins for digital IO:;
+#X restore 271 239 pd send-to-arduino----------------;
+#X obj 271 292 s \$0-arduino;
+#X msg 294 265 outputMode 13 1;
+#X text 412 265 set pin 13 to output mode;
+#X text 270 159 Set input/output mode of the pins for digital IO:;
#N canvas 374 455 492 344 ANALOG-INPUT 0;
#X obj 29 59 r \$0-arduino-out;
#X obj 29 97 spigot 0;
@@ -532,7 +532,7 @@ the ground \, if you want to avoid flickering of the values !;
#X connect 10 3 7 0;
#X connect 10 4 8 0;
#X connect 10 5 9 0;
-#X restore 185 526 pd ANALOG-INPUT;
+#X restore 185 462 pd ANALOG-INPUT;
#N canvas 729 582 542 358 ANALOG-OUTPUT-PWM 0;
#X text 16 17 Analog Output \, PWM (Pulse Width Modulation);
#X text 16 53 With the help of PWM you can write analog values to the
@@ -541,16 +541,16 @@ pins 9 \, 10 \, 11 of your Arduino board.;
!;
#X msg 21 189 pwm 9 \$1;
#X obj 24 168 hsl 150 17 0 1 0 0 empty empty PWM_control_(0-1) -2 -6
-1 10 -260818 -1 -1 6800 1;
+1 10 -260818 -1 -1 0 1;
#X msg 31 234 pwm 9 off;
#X obj 21 258 s \$0-arduino;
#X text 29 215 disable PWM:;
#X obj 192 168 hsl 150 17 0 1 0 0 empty empty PWM_control_(0-1) -2
--6 1 10 -260818 -1 -1 8200 1;
+-6 1 10 -260818 -1 -1 0 1;
#X obj 189 258 s \$0-arduino;
#X text 197 215 disable PWM:;
#X obj 354 168 hsl 150 17 0 1 0 0 empty empty PWM_control_(0-1) -2
--6 1 10 -260818 -1 -1 6400 1;
+-6 1 10 -260818 -1 -1 0 1;
#X obj 351 258 s \$0-arduino;
#X text 359 215 disable PWM:;
#X text 21 133 PIN9:;
@@ -571,18 +571,18 @@ to send software-PWM signals (will come soon ...);
#X connect 18 0 9 0;
#X connect 19 0 12 0;
#X connect 20 0 12 0;
-#X restore 150 551 pd ANALOG-OUTPUT-PWM;
-#X text 25 421 With the Arduino-Board you can do digital and analog
+#X restore 150 487 pd ANALOG-OUTPUT-PWM;
+#X text 25 357 With the Arduino-Board you can do digital and analog
input and output \, as descriped in the following sub-patches:;
-#X text 301 501 <- example of Digital Output;
-#X text 301 479 <- example of Digital Input;
-#X text 301 527 <- example of Analog Input;
-#X text 301 552 <- example of Analog Output;
-#X text 259 54 Arduino Interface For PD;
-#X text 286 28 ::::_PDUINO_::::;
-#X text 475 595 2006 \, released under GNU GPL \; Gerda Strobl \, Georg
+#X text 301 437 <- example of Digital Output;
+#X text 301 415 <- example of Digital Input;
+#X text 301 463 <- example of Analog Input;
+#X text 301 488 <- example of Analog Output;
+#X text 259 30 Arduino Interface For PD;
+#X text 286 4 ::::_PDUINO_::::;
+#X text 475 531 2006 \, released under GNU GPL \; Gerda Strobl \, Georg
Holzmann;
-#X text 86 305 <- list devices;
+#X text 86 241 <- list devices;
#X connect 2 0 13 0;
#X connect 3 0 4 0;
#X connect 3 0 5 0;
diff --git a/arduino-test.pd b/arduino-test.pd
index 088815f..079b5f7 100644
--- a/arduino-test.pd
+++ b/arduino-test.pd
@@ -1,11 +1,12 @@
-#N canvas 124 74 691 566 10;
-#X msg 166 173 open 3;
+#N canvas 219 143 695 547 10;
+#X obj 572 7 import mapping;
+#X msg 166 173 open 1;
#N canvas 627 365 360 384 serin 0;
-#X obj 180 61 cnv 15 15 15 empty \$0-number-canvas 3 4 8 0 14 -233017
+#X obj 180 61 cnv 15 15 15 empty \$0-number-canvas 1 4 8 0 14 -233017
-1 0;
#X obj 200 225 s \$0-number-canvas;
#X obj 60 61 hradio 15 1 1 8 empty empty empty 0 -6 0 8 -225271 -1
--1 3;
+-1 1;
#X obj 60 13 inlet;
#X msg 200 202 label \$1;
#X obj 200 180 makefilename %d;
@@ -35,111 +36,75 @@
#X msg 226 173 close;
#X obj 434 321 tgl 15 0 empty empty changes 0 -6 0 8 -262144 -1 -1
0 1;
-#X obj 353 61 hradio 15 1 0 14 empty empty empty 0 -6 0 8 -262131 -1
--1 0;
-#X obj 330 62 tgl 15 0 empty empty empty 0 -6 0 8 -262131 -1 -1 1 1
-;
#X obj 373 321 tgl 15 0 empty empty all 0 -6 0 8 -262144 -1 -1 0 1
;
-#N canvas 514 440 628 350 decode 0;
-#X obj 241 26 inlet;
-#X obj 545 189 & 1;
-#X obj 511 189 & 2;
-#X obj 477 189 & 4;
-#X obj 545 213 tgl 15 0 empty empty 0 4 25 1 12 -262144 -1 -1 0 1;
-#X obj 511 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-2;
-#X obj 477 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-4;
-#X obj 433 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-8;
-#X obj 389 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-16;
-#X obj 314 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-64;
-#X obj 277 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-128;
-#X obj 195 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-512;
-#X obj 151 213 tgl 15 0 empty empty 10 -1 25 1 12 -262144 -1 -1 0 1024
+#N canvas 110 264 433 283 decode 0;
+#X obj 138 25 inlet;
+#X obj 343 212 tgl 15 0 empty empty 0 4 25 1 12 -262144 -1 -1 1 1;
+#X obj 326 212 tgl 15 0 empty empty 1 4 25 1 12 -262144 -1 -1 0 2;
+#X obj 309 212 tgl 15 0 empty empty 2 4 25 1 12 -262144 -1 -1 0 4;
+#X obj 292 212 tgl 15 0 empty empty 3 4 25 1 12 -262144 -1 -1 8 8;
+#X obj 275 212 tgl 15 0 empty empty 4 4 25 1 12 -262144 -1 -1 16 16
;
-#X obj 107 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-2048;
-#X obj 63 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 4096
+#X obj 241 212 tgl 15 0 empty empty 6 4 25 1 12 -262144 -1 -1 0 256
;
-#X obj 19 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 8192
+#X floatatom 193 45 5 0 0 0 - - -;
+#X obj 258 212 tgl 15 0 empty empty 5 3 25 1 12 -262144 -1 -1 32 32
;
-#X obj 433 189 & 8;
-#X obj 389 189 & 16;
-#X obj 351 189 & 32;
-#X obj 314 189 & 64;
-#X obj 277 189 & 128;
-#X obj 236 189 & 256;
-#X obj 195 189 & 512;
-#X obj 151 189 & 1024;
-#X obj 107 189 & 2048;
-#X obj 63 189 & 4096;
-#X obj 19 189 & 8192;
-#X obj 261 273 outlet;
-#X floatatom 296 46 5 0 0 0 - - -;
-#X obj 236 213 tgl 15 0 empty empty 8 -1 25 1 12 -262144 -1 -1 0 256
+#X obj 248 129 debytemask;
+#X obj 89 84 >> 7;
+#X obj 183 212 tgl 15 0 empty empty 7 4 25 1 12 -262144 -1 -1 0 1;
+#X obj 166 212 tgl 15 0 empty empty 8 4 25 1 12 -262144 -1 -1 0 4096
;
-#X obj 351 213 tgl 15 0 empty empty 5 -1 25 1 12 -262144 -1 -1 0 32
+#X obj 149 212 tgl 15 0 empty empty 9 4 25 1 12 -262144 -1 -1 0 2048
;
-#X connect 0 0 1 0;
-#X connect 0 0 2 0;
-#X connect 0 0 3 0;
-#X connect 0 0 16 0;
-#X connect 0 0 17 0;
-#X connect 0 0 18 0;
-#X connect 0 0 19 0;
-#X connect 0 0 20 0;
-#X connect 0 0 21 0;
-#X connect 0 0 22 0;
-#X connect 0 0 23 0;
-#X connect 0 0 24 0;
-#X connect 0 0 25 0;
-#X connect 0 0 26 0;
-#X connect 0 0 28 0;
-#X connect 1 0 4 0;
-#X connect 2 0 5 0;
-#X connect 3 0 6 0;
-#X connect 16 0 7 0;
-#X connect 17 0 8 0;
-#X connect 18 0 30 0;
-#X connect 19 0 9 0;
-#X connect 20 0 10 0;
-#X connect 21 0 29 0;
-#X connect 22 0 11 0;
-#X connect 23 0 12 0;
-#X connect 24 0 13 0;
-#X connect 25 0 14 0;
-#X connect 26 0 15 0;
+#X obj 132 212 tgl 15 0 empty empty 10 4 25 1 12 -262144 -1 -1 0 1024
+;
+#X obj 115 212 tgl 15 0 empty empty 11 4 25 1 12 -262144 -1 -1 0 512
+;
+#X obj 81 212 tgl 15 0 empty empty 13 2 25 1 12 -262144 -1 -1 0 256
+;
+#X obj 98 212 tgl 15 0 empty empty 12 2 25 1 12 -262144 -1 -1 0 32
+;
+#X obj 88 129 debytemask;
+#X connect 0 0 7 0;
+#X connect 0 0 9 0;
+#X connect 0 0 10 0;
+#X connect 9 1 6 0;
+#X connect 9 2 8 0;
+#X connect 9 3 5 0;
+#X connect 9 4 4 0;
+#X connect 9 5 3 0;
+#X connect 9 6 2 0;
+#X connect 9 7 1 0;
+#X connect 10 0 18 0;
+#X connect 18 1 16 0;
+#X connect 18 2 17 0;
+#X connect 18 3 15 0;
+#X connect 18 4 14 0;
+#X connect 18 5 13 0;
+#X connect 18 6 12 0;
+#X connect 18 7 11 0;
#X restore 471 486 pd decode buttons;
#X obj 93 89 hsl 150 17 0 1 0 0 empty empty PWM_control_(0-1) -2 -6
1 10 -225271 -1 -1 0 0;
-#X text 461 47 7;
-#X text 355 47 0;
-#X text 502 47 10;
-#X obj 21 355 spigot 0;
-#X obj 64 326 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
+#X obj 58 315 tgl 15 1 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1
;
#X obj 21 377 route analog0 analog1 analog2 analog3 analog4 analog5
;
-#X obj 435 422 route digital;
-#X obj 521 442 print GARBAGE;
+#X obj 577 441 print GARBAGE;
#X floatatom 424 488 6 0 0 0 - - -;
-#X text 329 127 how many analogIns to enable:;
-#X obj 330 188 tgl 15 1 empty empty empty 0 -6 0 8 -257472 -1 -1 1
+#X text 459 137 how many analogIns to enable:;
+#X obj 460 198 tgl 15 1 empty empty empty 0 -6 0 8 -257472 -1 -1 1
1;
-#X text 353 187 enable/disable digitalIns;
-#X msg 330 206 digitalIns \$1;
-#X msg 330 164 analogIns 6;
+#X text 483 197 enable/disable digitalIns;
+#X msg 460 216 digitalIns \$1;
+#X msg 460 174 analogIns 0;
#N canvas 162 133 570 420 serin 0;
-#X obj 165 61 cnv 15 15 15 empty \$0-analog-number-canvas 6 4 8 0 14
+#X obj 165 61 cnv 15 15 15 empty \$0-analog-number-canvas 0 4 8 0 14
-233017 -1 0;
#X obj 60 61 hradio 15 1 1 7 empty empty empty 0 -6 0 8 -225280 -1
--1 6;
+-1 0;
#X obj 60 13 inlet;
#X msg 200 202 label \$1;
#X obj 200 180 makefilename %d;
@@ -162,10 +127,8 @@
#X connect 10 1 11 0;
#X connect 11 0 9 0;
#X coords 0 -1 1 1 121 17 1 60 60;
-#X restore 330 144 pd serin;
-#X text 546 47 13;
-#X text 328 33 turn on output mode for each pin (off = input);
-#N canvas 0 22 269 256 speed 0;
+#X restore 460 154 pd serin;
+#N canvas 0 22 409 289 speed 0;
#X obj 21 41 inlet;
#X obj 21 62 maxlib/speedlim 100;
#X obj 21 84 outlet;
@@ -184,9 +147,8 @@
#X obj 122 165 inlet;
#X obj 122 186 maxlib/speedlim 100;
#X obj 122 208 outlet;
-#X obj 132 175 inlet;
-#X obj 132 196 maxlib/speedlim 100;
-#X obj 132 218 outlet;
+#X obj 262 175 inlet;
+#X obj 262 218 outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 3 0 4 0;
@@ -200,7 +162,6 @@
#X connect 15 0 16 0;
#X connect 16 0 17 0;
#X connect 18 0 19 0;
-#X connect 19 0 20 0;
#X restore 21 399 pd speed limiting for displaying values with pegging
the CPU;
#N canvas 77 268 462 312 debugging 0;
@@ -232,43 +193,34 @@ the CPU;
#X connect 10 0 8 0;
#X connect 11 0 10 0;
#X restore 313 339 pd debugging stuff;
-#X text 351 235 use raw data to save settings more compactly;
#X floatatom 21 424 5 0 0 3 analog0 - -;
#X floatatom 90 424 5 0 0 3 analog1 - -;
#X floatatom 159 424 5 0 0 3 analog2 - -;
#X floatatom 228 424 5 0 0 3 analog3 - -;
#X floatatom 297 424 5 0 0 3 analog4 - -;
#X floatatom 366 424 5 0 0 3 analog5 - -;
-#X text 415 47 4;
-#X text 384 47 2;
-#X text 429 47 5;
-#X text 444 47 6;
-#X text 400 47 3;
-#X msg 330 103 outputMode 0 1;
-#N canvas 304 39 554 377 sending 0;
+#N canvas 304 39 550 365 sending 0;
#X obj 167 325 outlet;
-#X obj 49 64 tgl 15 0 empty empty 0 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 66 64 tgl 15 0 empty empty 1 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 83 64 tgl 15 0 empty empty 2 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 100 64 tgl 15 0 empty empty 3 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 117 64 tgl 15 0 empty empty 4 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 134 64 tgl 15 0 empty empty 5 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 151 64 tgl 15 0 empty empty 6 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 168 77 tgl 15 0 empty empty 6 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 185 77 tgl 15 0 empty empty 5 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 202 77 tgl 15 0 empty empty 4 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 219 77 tgl 15 0 empty empty 3 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 236 77 tgl 15 0 empty empty 2 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 253 77 tgl 15 0 empty empty 1 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 270 77 tgl 15 0 empty empty 0 4 -6 1 12 -233017 -1 -1 0 1;
#X text 60 11 The 8th bit is not used in the bitmask \, there are 7
bits of digital output values per byte.;
-#X obj 168 64 tgl 15 0 empty empty 7 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 185 64 tgl 15 0 empty empty 8 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 202 64 tgl 15 0 empty empty 9 4 -6 1 12 -233017 -1 -1 0 1;
-#X obj 219 64 tgl 15 0 empty empty 10 0 -6 1 12 -233017 -1 -1 0 1;
-#X obj 236 64 tgl 15 0 empty empty 11 0 -6 1 12 -233017 -1 -1 0 1;
-#X obj 253 64 tgl 15 0 empty empty 12 0 -6 1 12 -233017 -1 -1 0 1;
-#X obj 270 64 tgl 15 0 empty empty 13 0 -6 1 12 -233017 -1 -1 0 1;
+#X obj 49 77 tgl 15 0 empty empty 13 0 -6 1 12 -233017 -1 -1 0 1;
+#X obj 66 77 tgl 15 0 empty empty 12 0 -6 1 12 -233017 -1 -1 0 1;
+#X obj 83 77 tgl 15 0 empty empty 11 0 -6 1 12 -233017 -1 -1 0 1;
+#X obj 100 77 tgl 15 0 empty empty 10 0 -6 1 12 -233017 -1 -1 0 1;
+#X obj 117 77 tgl 15 0 empty empty 9 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 134 77 tgl 15 0 empty empty 8 4 -6 1 12 -233017 -1 -1 0 1;
+#X obj 151 77 tgl 15 0 empty empty 7 4 -6 1 12 -233017 -1 -1 0 1;
#X obj 167 140 trigger bang float;
-#X obj 167 105 mapping/bytemask;
-#X obj 48 105 mapping/bytemask;
#X obj 380 175 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
16383;
-#X obj 380 138 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+#X obj 380 138 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 16383
16383;
#X obj 379 156 metro 100;
#X obj 167 200 +;
@@ -276,40 +228,36 @@ bits of digital output values per byte.;
#X obj 288 161 << 7;
#X text 251 205 this will flash all pins set to output;
#X obj 380 45 inlet;
-#X connect 1 0 18 0;
-#X connect 2 0 18 1;
-#X connect 3 0 18 2;
-#X connect 4 0 18 3;
-#X connect 5 0 18 4;
-#X connect 6 0 18 5;
-#X connect 7 0 18 6;
-#X connect 9 0 17 0;
-#X connect 10 0 17 1;
-#X connect 11 0 17 2;
-#X connect 12 0 17 3;
-#X connect 13 0 17 4;
-#X connect 14 0 17 5;
-#X connect 15 0 17 6;
-#X connect 16 0 23 0;
-#X connect 16 1 24 0;
-#X connect 17 0 16 0;
-#X connect 18 0 23 0;
-#X connect 19 0 0 0;
-#X connect 20 0 21 0;
-#X connect 21 0 19 0;
-#X connect 22 0 0 0;
-#X connect 23 0 22 0;
-#X connect 24 0 22 1;
-#X connect 26 0 20 0;
+#X obj 91 118 bytemask;
+#X obj 167 118 bytemask;
+#X connect 1 0 26 1;
+#X connect 2 0 26 2;
+#X connect 3 0 26 3;
+#X connect 4 0 26 4;
+#X connect 5 0 26 5;
+#X connect 6 0 26 6;
+#X connect 7 0 26 7;
+#X connect 9 0 25 1;
+#X connect 10 0 25 2;
+#X connect 11 0 25 3;
+#X connect 12 0 25 4;
+#X connect 13 0 25 5;
+#X connect 14 0 25 6;
+#X connect 15 0 25 7;
+#X connect 16 0 21 0;
+#X connect 16 1 22 0;
+#X connect 17 0 0 0;
+#X connect 18 0 19 0;
+#X connect 19 0 17 0;
+#X connect 20 0 0 0;
+#X connect 21 0 20 0;
+#X connect 22 0 20 1;
+#X connect 24 0 18 0;
+#X connect 25 0 21 0;
+#X connect 26 0 16 0;
#X restore 20 249 pd sending digital outs;
-#X msg 398 251 251 \, 9 \, 20 \, 142 \, 213;
#X text 325 292 <- argument sets port #;
#X msg 57 89 off;
-#X text 475 47 8;
-#X text 492 47 9;
-#X text 516 47 11;
-#X text 531 47 12;
-#X text 370 47 1;
#X obj 35 61 hradio 15 1 0 14 empty empty empty 0 -6 0 8 -176124 -1
-1 0;
#X text 143 47 7;
@@ -367,76 +315,161 @@ bits of digital output values per byte.;
#X connect 16 0 17 0;
#X connect 17 0 14 0;
#X restore 36 115 pd pwm;
-#X msg 36 135 pwm 10 0.436242;
-#N canvas 45 415 403 327 pin 0;
-#X obj 42 19 inlet;
-#X obj 218 20 inlet;
-#X obj 64 154 pack float float;
-#X obj 218 92 trigger bang float;
-#X text 82 19 input(0)/output(1);
-#X msg 64 180 outputMode \$2 \$1;
-#X obj 64 277 outlet;
-#X obj 64 206 trigger bang anything;
-#X obj 206 226 list;
-#X msg 206 246 set \$1 \$2 \$3;
-#X connect 0 0 2 0;
-#X connect 1 0 3 0;
-#X connect 2 0 5 0;
-#X connect 3 0 2 0;
-#X connect 3 1 2 1;
-#X connect 5 0 7 0;
-#X connect 7 0 6 0;
-#X connect 7 1 8 0;
-#X connect 8 0 9 0;
-#X connect 9 0 6 0;
-#X restore 330 82 pd pin mode;
+#X msg 36 135 pwm 11 off;
#X obj 255 293 arduino 1;
-#X text 17 7 The [arduino] object works with the Firmata firmware for
-Arduino.;
-#X msg 195 196 info;
-#X obj 20 230 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 16383
-;
+#X msg 333 176 info;
+#X obj 20 230 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 16383
+16383;
#X text 38 229 pulse all outputs;
-#X connect 0 0 71 0;
-#X connect 1 0 0 0;
-#X connect 5 0 71 0;
-#X connect 6 0 30 2;
-#X connect 7 0 70 1;
-#X connect 8 0 70 0;
-#X connect 9 0 30 1;
-#X connect 11 0 68 1;
-#X connect 15 0 17 0;
-#X connect 16 0 15 1;
-#X connect 17 0 29 0;
-#X connect 17 1 29 1;
-#X connect 17 2 29 2;
-#X connect 17 3 29 3;
-#X connect 17 4 29 4;
-#X connect 17 5 29 5;
-#X connect 17 6 29 6;
-#X connect 18 0 10 0;
-#X connect 18 0 20 0;
-#X connect 18 1 19 0;
-#X connect 22 0 24 0;
-#X connect 24 0 71 0;
-#X connect 25 0 71 0;
-#X connect 26 0 25 0;
-#X connect 29 0 32 0;
-#X connect 29 1 33 0;
-#X connect 29 2 34 0;
-#X connect 29 3 35 0;
-#X connect 29 4 36 0;
-#X connect 29 5 37 0;
-#X connect 29 6 18 0;
-#X connect 43 0 71 0;
-#X connect 44 0 71 0;
-#X connect 45 0 71 1;
-#X connect 47 0 68 1;
-#X connect 53 0 68 0;
-#X connect 68 0 69 0;
-#X connect 69 0 71 0;
-#X connect 70 0 43 0;
-#X connect 71 0 15 0;
-#X connect 71 1 30 0;
-#X connect 73 0 71 0;
-#X connect 74 0 44 0;
+#X msg 372 176 version;
+#X obj 435 422 route digital version;
+#X obj 506 460 print [arduino]_VERSION;
+#X obj 21 345 spigot;
+#X text 18 7 The [arduino] object works with the Firmata firmware for
+Arduino (previously known as Pduino firmware).;
+#X obj 352 70 tgl 15 0 empty empty 1 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 370 70 tgl 15 0 empty empty 2 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 388 70 tgl 15 0 empty empty 3 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 406 70 tgl 15 0 empty empty 4 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 424 70 tgl 15 0 empty empty 5 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 442 70 tgl 15 0 empty empty 6 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 460 70 tgl 15 0 empty empty 7 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 478 70 tgl 15 0 empty empty 8 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 496 70 tgl 15 0 empty empty 9 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 514 70 tgl 15 0 empty empty 10 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 532 70 tgl 15 0 empty empty 11 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 550 70 tgl 15 0 empty empty 12 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 568 70 tgl 15 0 empty empty 13 3 -6 0 10 -260818 -1 -1 0 1;
+#X obj 594 50 tgl 20 0 empty empty empty 0 -6 0 8 -258699 -1 -1 0 1
+;
+#X obj 334 70 tgl 15 0 empty empty 0 3 -6 0 10 -260818 -1 -1 0 1;
+#N canvas 554 328 750 300 send-to-arduino---------------- 0;
+#X obj 49 54 inlet;
+#X obj 89 54 inlet;
+#X obj 128 54 inlet;
+#X obj 168 54 inlet;
+#X obj 208 54 inlet;
+#X obj 248 54 inlet;
+#X obj 287 54 inlet;
+#X obj 327 54 inlet;
+#X obj 368 53 inlet;
+#X obj 408 53 inlet;
+#X obj 447 53 inlet;
+#X obj 487 53 inlet;
+#X obj 527 53 inlet;
+#X msg 49 96 outputMode 0 \$1;
+#X msg 89 118 outputMode 1 \$1;
+#X msg 128 140 outputMode 2 \$1;
+#X msg 168 160 outputMode 3 \$1;
+#X msg 208 92 outputMode 4 \$1;
+#X msg 248 114 outputMode 5 \$1;
+#X msg 287 136 outputMode 6 \$1;
+#X msg 327 156 outputMode 7 \$1;
+#X msg 368 88 outputMode 8 \$1;
+#X msg 408 110 outputMode 9 \$1;
+#X msg 447 132 outputMode 10 \$1;
+#X msg 487 152 outputMode 11 \$1;
+#X msg 527 80 outputMode 12 \$1;
+#X obj 566 53 inlet;
+#X msg 566 100 outputMode 13 \$1;
+#X obj 305 226 outlet;
+#X connect 0 0 13 0;
+#X connect 1 0 14 0;
+#X connect 2 0 15 0;
+#X connect 3 0 16 0;
+#X connect 4 0 17 0;
+#X connect 5 0 18 0;
+#X connect 6 0 19 0;
+#X connect 7 0 20 0;
+#X connect 8 0 21 0;
+#X connect 9 0 22 0;
+#X connect 10 0 23 0;
+#X connect 11 0 24 0;
+#X connect 12 0 25 0;
+#X connect 13 0 28 0;
+#X connect 14 0 28 0;
+#X connect 15 0 28 0;
+#X connect 16 0 28 0;
+#X connect 17 0 28 0;
+#X connect 18 0 28 0;
+#X connect 19 0 28 0;
+#X connect 20 0 28 0;
+#X connect 21 0 28 0;
+#X connect 22 0 28 0;
+#X connect 23 0 28 0;
+#X connect 24 0 28 0;
+#X connect 25 0 28 0;
+#X connect 26 0 27 0;
+#X connect 27 0 28 0;
+#X restore 334 97 pd send-to-arduino----------------;
+#X text 328 34 turn on output mode for each pin (off=input);
+#X text 616 53 all;
+#X connect 1 0 49 0;
+#X connect 2 0 1 0;
+#X connect 6 0 49 0;
+#X connect 7 0 22 2;
+#X connect 8 0 22 1;
+#X connect 10 0 47 1;
+#X connect 11 0 56 1;
+#X connect 12 0 21 0;
+#X connect 12 1 21 1;
+#X connect 12 2 21 2;
+#X connect 12 3 21 3;
+#X connect 12 4 21 4;
+#X connect 12 5 21 5;
+#X connect 12 6 21 6;
+#X connect 16 0 18 0;
+#X connect 18 0 49 0;
+#X connect 19 0 49 0;
+#X connect 20 0 19 0;
+#X connect 21 0 23 0;
+#X connect 21 1 24 0;
+#X connect 21 2 25 0;
+#X connect 21 3 26 0;
+#X connect 21 4 27 0;
+#X connect 21 5 28 0;
+#X connect 21 6 54 0;
+#X connect 29 0 49 0;
+#X connect 31 0 47 1;
+#X connect 32 0 47 0;
+#X connect 47 0 48 0;
+#X connect 48 0 49 0;
+#X connect 49 0 56 0;
+#X connect 49 1 22 0;
+#X connect 50 0 49 0;
+#X connect 51 0 29 0;
+#X connect 53 0 49 0;
+#X connect 54 0 9 0;
+#X connect 54 0 14 0;
+#X connect 54 1 55 0;
+#X connect 54 2 13 0;
+#X connect 56 0 12 0;
+#X connect 58 0 73 1;
+#X connect 59 0 73 2;
+#X connect 60 0 73 3;
+#X connect 61 0 73 4;
+#X connect 62 0 73 5;
+#X connect 63 0 73 6;
+#X connect 64 0 73 7;
+#X connect 65 0 73 8;
+#X connect 66 0 73 9;
+#X connect 67 0 73 10;
+#X connect 68 0 73 11;
+#X connect 69 0 73 12;
+#X connect 70 0 73 13;
+#X connect 71 0 70 0;
+#X connect 71 0 69 0;
+#X connect 71 0 68 0;
+#X connect 71 0 67 0;
+#X connect 71 0 66 0;
+#X connect 71 0 65 0;
+#X connect 71 0 64 0;
+#X connect 71 0 63 0;
+#X connect 71 0 62 0;
+#X connect 71 0 61 0;
+#X connect 71 0 60 0;
+#X connect 71 0 59 0;
+#X connect 71 0 58 0;
+#X connect 71 0 72 0;
+#X connect 72 0 73 0;
+#X connect 73 0 49 0;
diff --git a/arduino.pd b/arduino.pd
index 826a91e..e79293b 100644
--- a/arduino.pd
+++ b/arduino.pd
@@ -1,63 +1,12 @@
-#N canvas 404 56 608 521 10;
+#N canvas 628 43 617 333 10;
#X obj 462 15 import flatspace;
-#X text 414 487 released under the GNU GPL;
-#X text 9 487 (C) Copyright 2006 Hans-Christoph Steiner <hans@at.or.at>
+#X text 415 287 released under the GNU GPL;
+#X text 10 287 (C) Copyright 2006 Hans-Christoph Steiner <hans@at.or.at>
;
-#N canvas 562 456 470 320 alternate 0;
-#X obj 87 8 inlet;
-#X obj 151 244 outlet;
-#X obj 319 247 outlet;
-#X obj 159 197 spigot;
-#X obj 319 191 spigot;
-#X obj 158 57 trigger anything bang;
-#X obj 196 152 abs;
-#X obj 356 147 abs;
-#X msg 295 77 1;
-#X obj 196 173 float;
-#X obj 355 168 float;
-#X obj 86 34 route reset;
-#X obj 356 128 -;
-#X obj 196 133 -;
-#X obj 15 35 loadbang;
-#X obj 86 54 bang;
-#X msg 73 82 1;
-#X msg 103 82 0;
-#X connect 0 0 11 0;
-#X connect 3 0 1 0;
-#X connect 4 0 2 0;
-#X connect 5 0 3 0;
-#X connect 5 0 4 0;
-#X connect 5 1 8 0;
-#X connect 6 0 9 0;
-#X connect 7 0 10 0;
-#X connect 8 0 12 0;
-#X connect 8 0 13 0;
-#X connect 9 0 3 1;
-#X connect 9 0 13 1;
-#X connect 10 0 4 1;
-#X connect 10 0 12 1;
-#X connect 11 0 15 0;
-#X connect 11 1 5 0;
-#X connect 12 0 7 0;
-#X connect 13 0 6 0;
-#X connect 14 0 17 0;
-#X connect 14 0 16 0;
-#X connect 15 0 17 0;
-#X connect 15 0 16 0;
-#X connect 16 0 13 1;
-#X connect 17 0 12 1;
-#X restore 76 191 pd alternate;
-#X msg 11 160 reset;
-#X obj 120 233 +;
-#X obj 120 254 trigger bang float;
-#X obj 126 405 pack symbol float;
-#X msg 124 288 0;
-#X obj 11 138 select 255;
-#X obj 76 210 * 128;
#X obj 11 21 inlet;
-#X obj 126 455 outlet;
+#X obj 11 196 outlet;
#X obj 494 241 outlet;
-#N canvas 275 202 542 337 command 0;
+#N canvas 120 132 612 337 command 0;
#X obj 46 8 inlet;
#X obj 148 269 outlet;
#X obj 100 94 clip 0 6;
@@ -83,7 +32,7 @@
#X connect 5 2 8 0;
#X connect 7 0 4 0;
#X connect 8 0 1 0;
-#X restore 403 93 pd digital-out;
+#X restore 449 93 pd digital-out;
#N canvas 90 168 520 327 outputMode 0;
#X obj 60 11 inlet;
#X obj 175 275 outlet;
@@ -123,9 +72,9 @@ to input;
#X obj 232 185 * 255;
#X obj 232 164 clip 0 1;
#X obj 232 205 int;
-#N canvas 0 0 450 300 list-rev 0;
+#N canvas 0 22 450 300 list-rev 0;
#X obj 92 29 inlet;
-#N canvas 0 0 533 407 drip 0;
+#N canvas 0 22 533 407 drip 0;
#X obj 64 206 list split 1;
#X obj 64 123 until;
#X obj 64 181 list append;
@@ -190,9 +139,11 @@ to input;
#X connect 14 0 2 0;
#X connect 14 1 1 0;
#X restore 30 94 pd pwm;
-#X obj 46 52 route pwm analogIns digitalIns outputMode info;
-#X msg 355 94 info;
-#X connect 0 0 10 0;
+#X msg 340 94 info;
+#X obj 46 52 route pwm analogIns digitalIns outputMode info version
+;
+#X msg 390 93 240;
+#X connect 0 0 11 0;
#X connect 2 0 7 0;
#X connect 3 0 4 0;
#X connect 4 0 8 0;
@@ -201,51 +152,114 @@ to input;
#X connect 7 0 1 0;
#X connect 8 0 1 0;
#X connect 9 0 1 0;
-#X connect 10 0 9 0;
-#X connect 10 1 2 0;
-#X connect 10 2 3 0;
-#X connect 10 3 6 0;
-#X connect 10 4 11 0;
-#X connect 10 5 5 0;
-#X connect 11 0 1 0;
+#X connect 10 0 1 0;
+#X connect 11 0 9 0;
+#X connect 11 1 2 0;
+#X connect 11 2 3 0;
+#X connect 11 3 6 0;
+#X connect 11 4 10 0;
+#X connect 11 5 12 0;
+#X connect 11 6 5 0;
+#X connect 12 0 1 0;
#X restore 11 52 pd command processing;
-#X obj 76 162 moses 128;
-#X msg 27 376 symbol digital;
-#X obj 142 375 makefilename analog%c;
-#X obj 99 309 float;
-#X obj 138 309 + 1;
-#X obj 126 430 list trim;
-#X obj 99 331 select 0;
-#X text 287 285 DEBUG/RAW data (this will change);
-#X obj 142 353 + 47;
+#X text 257 242 DEBUG/RAW data (this will change);
#X obj 379 19 inlet;
#X text 354 0 raw input;
#X text 10 -1 processed input;
#X obj 11 96 comport \$1 19200;
-#X connect 3 0 10 0;
-#X connect 3 1 5 1;
+#N canvas 182 25 380 443 make 0;
+#X obj 147 8 inlet;
+#X obj 71 334 outlet;
+#X obj 147 37 moses 128;
+#X obj 27 198 float;
+#N canvas 382 81 506 356 alternate 0;
+#X obj 34 280 outlet;
+#X obj 209 277 outlet;
+#X obj 34 210 spigot;
+#X obj 209 204 spigot;
+#X obj 33 87 trigger anything bang;
+#X msg 175 107 1;
+#X obj 71 186 float;
+#X obj 245 181 float;
+#X obj 357 41 loadbang;
+#X obj 342 74 bang;
+#X obj 246 158 !=;
+#X obj 71 163 !=;
+#X obj 342 7 inlet;
+#X text 384 6 reset;
+#X obj 33 12 inlet;
+#X msg 329 102 1;
+#X msg 359 102 0;
+#X connect 2 0 0 0;
+#X connect 3 0 1 0;
+#X connect 4 0 2 0;
#X connect 4 0 3 0;
-#X connect 4 0 8 0;
-#X connect 5 0 6 0;
-#X connect 6 0 18 0;
-#X connect 6 1 7 1;
-#X connect 7 0 20 0;
-#X connect 8 0 18 1;
-#X connect 9 0 4 0;
-#X connect 9 1 15 0;
-#X connect 10 0 5 0;
-#X connect 11 0 14 0;
-#X connect 14 0 27 0;
-#X connect 15 0 3 0;
-#X connect 16 0 7 0;
-#X connect 17 0 7 0;
-#X connect 18 0 19 0;
-#X connect 18 0 21 0;
-#X connect 19 0 18 1;
-#X connect 20 0 12 0;
-#X connect 21 0 16 0;
-#X connect 21 1 23 0;
-#X connect 23 0 17 0;
-#X connect 24 0 27 0;
-#X connect 27 0 9 0;
-#X connect 27 0 13 0;
+#X connect 4 1 5 0;
+#X connect 5 0 10 0;
+#X connect 5 0 11 0;
+#X connect 6 0 2 1;
+#X connect 6 0 11 1;
+#X connect 7 0 3 1;
+#X connect 7 0 10 1;
+#X connect 8 0 9 0;
+#X connect 9 0 16 0;
+#X connect 9 0 15 0;
+#X connect 10 0 7 0;
+#X connect 11 0 6 0;
+#X connect 12 0 9 0;
+#X connect 14 0 4 0;
+#X connect 15 0 11 1;
+#X connect 16 0 10 1;
+#X restore 147 130 pd alternate;
+#X obj 27 173 trigger bang float;
+#X obj 226 111 bang;
+#N canvas 0 22 576 352 convert 0;
+#X obj 98 22 inlet;
+#X obj 163 314 outlet;
+#X obj 365 204 print UNKNOWN_INPUT_COMMAND;
+#X obj 98 68 select 151 240;
+#X obj 191 89 moses 161;
+#X obj 250 113 moses 167;
+#X obj 188 195 makefilename analog%c;
+#X obj 188 174 - 113;
+#X msg 117 131 symbol version;
+#X msg 8 131 symbol digital;
+#X connect 0 0 3 0;
+#X connect 3 0 9 0;
+#X connect 3 1 8 0;
+#X connect 3 2 4 0;
+#X connect 4 0 2 0;
+#X connect 4 1 5 0;
+#X connect 5 0 7 0;
+#X connect 5 1 2 0;
+#X connect 6 0 1 0;
+#X connect 7 0 6 0;
+#X connect 8 0 1 0;
+#X connect 9 0 1 0;
+#X restore 27 219 pd convert commands;
+#X obj 70 296 list trim;
+#X obj 70 273 pack symbol float;
+#X obj 184 219 +;
+#X obj 200 197 * 128;
+#X connect 0 0 2 0;
+#X connect 2 0 4 0;
+#X connect 2 1 3 1;
+#X connect 2 1 6 0;
+#X connect 3 0 7 0;
+#X connect 4 0 5 0;
+#X connect 4 1 11 0;
+#X connect 5 0 3 0;
+#X connect 5 1 10 0;
+#X connect 6 0 4 1;
+#X connect 7 0 9 0;
+#X connect 8 0 1 0;
+#X connect 9 0 8 0;
+#X connect 10 0 9 1;
+#X connect 11 0 10 1;
+#X restore 10 165 pd make lists;
+#X connect 3 0 6 0;
+#X connect 6 0 11 0;
+#X connect 8 0 11 0;
+#X connect 11 0 5 0;
+#X connect 11 0 12 0;
+#X connect 12 0 4 0;