aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-02-22 06:16:43 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-02-22 06:16:43 +0000
commitdc109d32224893043297d5479c6a0a0b09476e06 (patch)
treef4da0331d807c0dcde8086e08377c496b89a45fb
parent171edde7e786f7e0989a55846545336748b706f8 (diff)
- got analog input working
- version reporting works, but checkInput() isn't run enough, so it misses the data if there is a lot of traffic on the serial port svn path=/trunk/externals/hardware/arduino/; revision=7444
-rw-r--r--Pd_firmware/Pd_firmware.pde256
-rw-r--r--arduino-test.pd39
-rw-r--r--arduino.pd341
3 files changed, 336 insertions, 300 deletions
diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde
index 3eabc7d..a0ca913 100644
--- a/Pd_firmware/Pd_firmware.pde
+++ b/Pd_firmware/Pd_firmware.pde
@@ -56,7 +56,7 @@
* TODO: use Program Control to load stored profiles from EEPROM
*/
-/* cvs version: $Id: Pd_firmware.pde,v 1.23 2007-02-20 06:25:56 eighthave Exp $ */
+/* cvs version: $Id: Pd_firmware.pde,v 1.24 2007-02-22 06:16:43 eighthave Exp $ */
/*==========================================================================
* MESSAGE FORMATS
@@ -168,7 +168,8 @@
#define MAJOR_VERSION 1 // for non-compatible changes
#define MINOR_VERSION 0 // for backwards compatible changes
-/* total number of digital pins supported */
+/* total number of pins currently supported */
+#define TOTAL_ANALOG_PINS 16
#define TOTAL_DIGITAL_PINS 14
// for comparing along with INPUT and OUTPUT
@@ -206,6 +207,9 @@ int digitalPinStatus = 0;
* the rest of the bits are unused and should remain 0 */
int pwmStatus = 0;
+/* bit-wise array to store pin reporting */
+unsigned int analogPinsToReport = 65536;
+
/*==========================================================================
* FUNCTIONS
@@ -215,17 +219,17 @@ int pwmStatus = 0;
* output digital bytes received from the serial port
*/
void outputDigitalBytes(byte pin0_6, byte pin7_13) {
- int i;
- int mask;
- int twoBytesForPorts;
-
- twoBytesForPorts = pin0_6 + (pin7_13 << 7);
- for(i=0; i<14; ++i) {
- mask = 1 << i;
- if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) {
- digitalWrite(i, twoBytesForPorts & mask);
- }
- }
+ int i;
+ int mask;
+ int twoBytesForPorts;
+
+ twoBytesForPorts = pin0_6 + (pin7_13 << 7);
+ for(i=0; i<14; ++i) {
+ mask = 1 << i;
+ if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) {
+ digitalWrite(i, twoBytesForPorts & mask);
+ }
+ }
}
/* -------------------------------------------------------------------------
@@ -233,60 +237,60 @@ void outputDigitalBytes(byte pin0_6, byte pin7_13) {
* Arduino's serial port. This is where the commands are handled.
*/
void processInput(int inputData) {
- int command, channel;
-
- // a few commands have byte(s) of data following the command
- if( (waitForData > 0) && (inputData < 128) ) {
- waitForData--;
- storedInputData[waitForData] = inputData;
- if( (waitForData==0) && executeMultiByteCommand ) {
- //we got everything
- switch(executeMultiByteCommand) {
- case ANALOG_MESSAGE:
- channel = inputData & 0x0F; // get channel from command byte
- break;
- case DIGITAL_MESSAGE:
- outputDigitalBytes(storedInputData[1], storedInputData[0]);
- break;
- case SET_DIGITAL_PIN_MODE:
- setPinMode(storedInputData[1], storedInputData[0]);
- break;
- case REPORT_ANALOG_PIN:
- break;
- case REPORT_DIGITAL_PORTS:
- break;
- }
- executeMultiByteCommand = 0;
- }
- } else {
- // remove channel info from command byte if less than 0xF0
- if(inputData < 0xF0) {
- command = inputData & 0xF0;
- } else {
- command = inputData;
- }
- switch (inputData) {
- case ANALOG_MESSAGE:
- case DIGITAL_MESSAGE:
- case SET_DIGITAL_PIN_MODE:
- waitForData = 2; // two data bytes needed
- executeMultiByteCommand = inputData;
- break;
- case REPORT_ANALOG_PIN:
- case REPORT_DIGITAL_PORTS:
- waitForData = 1; // two data bytes needed
- executeMultiByteCommand = inputData;
- break;
- case SYSTEM_RESET:
- // this doesn't do anything yet
- break;
- case REPORT_VERSION:
- Serial.print(REPORT_VERSION, BYTE);
- Serial.print(MAJOR_VERSION, BYTE);
- Serial.print(MINOR_VERSION, BYTE);
- break;
- }
- }
+ int command, channel;
+
+ // a few commands have byte(s) of data following the command
+ if( (waitForData > 0) && (inputData < 128) ) {
+ waitForData--;
+ storedInputData[waitForData] = inputData;
+ if( (waitForData==0) && executeMultiByteCommand ) {
+ //we got everything
+ switch(executeMultiByteCommand) {
+ case ANALOG_MESSAGE:
+ channel = inputData & 0x0F; // get channel from command byte
+ break;
+ case DIGITAL_MESSAGE:
+ outputDigitalBytes(storedInputData[1], storedInputData[0]);
+ break;
+ case SET_DIGITAL_PIN_MODE:
+ setPinMode(storedInputData[1], storedInputData[0]);
+ break;
+ case REPORT_ANALOG_PIN:
+ break;
+ case REPORT_DIGITAL_PORTS:
+ break;
+ }
+ executeMultiByteCommand = 0;
+ }
+ } else {
+ // remove channel info from command byte if less than 0xF0
+ if(inputData < 0xF0) {
+ command = inputData & 0xF0;
+ } else {
+ command = inputData;
+ }
+ switch (inputData) {
+ case ANALOG_MESSAGE:
+ case DIGITAL_MESSAGE:
+ case SET_DIGITAL_PIN_MODE:
+ waitForData = 2; // two data bytes needed
+ executeMultiByteCommand = inputData;
+ break;
+ case REPORT_ANALOG_PIN:
+ case REPORT_DIGITAL_PORTS:
+ waitForData = 1; // two data bytes needed
+ executeMultiByteCommand = inputData;
+ break;
+ case SYSTEM_RESET:
+ // this doesn't do anything yet
+ break;
+ case REPORT_VERSION:
+ Serial.print(REPORT_VERSION, BYTE);
+ Serial.print(MINOR_VERSION, BYTE);
+ Serial.print(MAJOR_VERSION, BYTE);
+ break;
+ }
+ }
}
@@ -300,8 +304,8 @@ void processInput(int inputData) {
* Therefore, it only checks for input once per cycle of the serial port.
*/
void checkForInput() {
- if(Serial.available())
- processInput( Serial.read() );
+ if(Serial.available())
+ processInput( Serial.read() );
}
// -------------------------------------------------------------------------
@@ -309,71 +313,87 @@ void checkForInput() {
* bits in the two bit-arrays that track Digital I/O and PWM status
*/
void setPinMode(byte pin, byte mode) {
- if(mode == INPUT) {
- digitalPinStatus = digitalPinStatus &~ (1 << pin);
- pwmStatus = pwmStatus &~ (1 << pin);
- pinMode(pin,INPUT);
- }
- else if(mode == OUTPUT) {
- digitalPinStatus = digitalPinStatus | (1 << pin);
- pwmStatus = pwmStatus &~ (1 << pin);
- pinMode(pin,OUTPUT);
- }
- else if( mode == PWM ) {
- digitalPinStatus = digitalPinStatus | (1 << pin);
- pwmStatus = pwmStatus | (1 << pin);
- pinMode(pin,OUTPUT);
- }
-// TODO: save status to EEPROM here, if changed
+ if(mode == INPUT) {
+ digitalPinStatus = digitalPinStatus &~ (1 << pin);
+ pwmStatus = pwmStatus &~ (1 << pin);
+ pinMode(pin,INPUT);
+ }
+ else if(mode == OUTPUT) {
+ digitalPinStatus = digitalPinStatus | (1 << pin);
+ pwmStatus = pwmStatus &~ (1 << pin);
+ pinMode(pin,OUTPUT);
+ }
+ else if( mode == PWM ) {
+ digitalPinStatus = digitalPinStatus | (1 << pin);
+ pwmStatus = pwmStatus | (1 << pin);
+ pinMode(pin,OUTPUT);
+ }
+ // TODO: save status to EEPROM here, if changed
}
// =========================================================================
// used for flashing the pin for the version number
void pin13strobe(int count, int onInterval, int offInterval) {
- byte i;
- for(i=0; i<count; i++) {
- digitalWrite(13,1);
- delay(onInterval);
- digitalWrite(13,0);
- delay(offInterval);
- }
+ byte i;
+ for(i=0; i<count; i++) {
+ digitalWrite(13,1);
+ delay(onInterval);
+ digitalWrite(13,0);
+ delay(offInterval);
+ }
}
/*==========================================================================
* SETUP()
*==========================================================================*/
void setup() {
- byte i;
-
-// TODO: load state from EEPROM here
- Serial.begin(115200); // 9600, 14400, 38400, 57600, 115200
-
-/* TODO: send digital inputs here, if enabled, to set the initial state on the
- * host computer, since once in the loop(), the Arduino will only send data on
- * change. */
-
-// flash the pin 13 with the protocol minor version (add major once > 0)
- pinMode(13,OUTPUT);
- pin13strobe(10,5,20); // separator, a quick burst
- delay(500);
- pin13strobe(MAJOR_VERSION, 200, 400);
- delay(500);
- pin13strobe(10,5,20); // separator, a quick burst
- delay(500);
- pin13strobe(MINOR_VERSION, 200, 400);
- delay(500);
- pin13strobe(10,5,20); // separator, a quick burst
- delay(1000);
- for(i=0; i<TOTAL_DIGITAL_PINS; ++i) {
- setPinMode(i,OUTPUT);
- }
+ byte i;
+
+ // TODO: load state from EEPROM here
+ Serial.begin(115200); // 9600, 14400, 38400, 57600, 115200
+
+ /* TODO: send digital inputs here, if enabled, to set the initial state on the
+ * host computer, since once in the loop(), the Arduino will only send data on
+ * change. */
+
+ // flash the pin 13 with the protocol minor version (add major once > 0)
+ pinMode(13,OUTPUT);
+ pin13strobe(10,5,20); // separator, a quick burst
+ delay(500);
+ pin13strobe(MAJOR_VERSION, 200, 400);
+ delay(500);
+ pin13strobe(10,5,20); // separator, a quick burst
+ delay(500);
+ pin13strobe(MINOR_VERSION, 200, 400);
+ delay(500);
+ pin13strobe(10,5,20); // separator, a quick burst
+ delay(1000);
+ for(i=0; i<TOTAL_DIGITAL_PINS; ++i) {
+ setPinMode(i,OUTPUT);
+ }
}
/*==========================================================================
* LOOP()
*==========================================================================*/
void loop() {
-
- checkForInput();
+ int i; // counter for analog pins
+ int analogData;
+
+ checkForInput();
+ /* get analog in, for the number enabled */
+ for(i=0; i<TOTAL_ANALOG_PINS; ++i) {
+ checkForInput();
+ //if( analogPinsToReport & (1 << i) ) {
+ analogData = analogRead(i);
+ /* These two bytes get converted back into the whole number on host.
+ Highest bits should be zeroed so the 8th bit doesn't get set */
+ checkForInput();
+ Serial.print(ANALOG_MESSAGE + i, BYTE);
+ Serial.print(analogData % 128, BYTE); // mod by 32 for the small byte
+ Serial.print(analogData >> 7, BYTE); // shift high bits into output byte
+ //}
+ checkForInput();
+ }
}
diff --git a/arduino-test.pd b/arduino-test.pd
index e3fa724..b2fe913 100644
--- a/arduino-test.pd
+++ b/arduino-test.pd
@@ -1,4 +1,4 @@
-#N canvas 216 76 699 540 10;
+#N canvas 216 76 703 544 10;
#X obj 512 7 import hardware mapping;
#X obj 323 136 cnv 15 100 22 empty empty empty 20 12 0 14 -253938 -66577
0;
@@ -45,8 +45,8 @@
#X obj 520 328 tgl 15 0 empty empty all 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 138 119 hsl 150 17 0 1 0 0 empty empty PWM_control_(0-1) -2
--6 1 10 -225271 -1 -1 0 0;
-#X obj 277 332 tgl 15 1 empty empty empty 0 -6 0 8 -225271 -1 -1 1
+-6 1 10 -225271 -1 -1 8800 0;
+#X obj 277 332 tgl 15 1 empty empty empty 0 -6 0 8 -225271 -1 -1 0
1;
#X text 454 156 how many analogIns to enable:;
#X obj 455 217 tgl 15 1 empty empty empty 0 -6 0 8 -257472 -1 -1 0
@@ -152,7 +152,7 @@
#X text 300 311 <- argument sets port #;
#X msg 102 119 off;
#X obj 80 91 hradio 15 1 0 14 empty empty empty 0 -6 0 8 -176124 -1
--1 0;
+-1 11;
#X text 188 77 7;
#X text 82 77 0;
#X text 229 77 10;
@@ -167,7 +167,7 @@
#X text 245 77 11;
#X text 260 77 12;
#X text 97 77 1;
-#N canvas 66 58 415 495 pwm 0;
+#N canvas 66 58 419 499 pwm 0;
#X obj 38 10 inlet;
#X obj 131 10 inlet;
#X msg 37 308 pwm \$1 \$2;
@@ -208,7 +208,7 @@
#X connect 16 0 17 0;
#X connect 17 0 14 0;
#X restore 81 145 pd pwm;
-#X msg 81 167 pwm 0 0;
+#X msg 81 167 pwm 11 0.590604;
#X msg 328 195 info;
#X msg 367 195 version;
#X obj 468 422 print [arduino]_VERSION;
@@ -428,28 +428,28 @@ Arduino (previously known as Pduino firmware).;
#X obj 121 389 route 0 1 2 3 4 5 6 7;
#N canvas 0 22 499 396 display 0;
#X obj 6 7 inlet;
-#X obj 6 28 maxlib/speedlim 100;
+#X obj 6 28 mapping/resample 100;
#X obj 6 50 outlet;
#X obj 54 50 inlet;
-#X obj 54 71 maxlib/speedlim 100;
+#X obj 54 71 mapping/resample 100;
#X obj 54 93 outlet;
#X obj 103 93 inlet;
-#X obj 103 114 maxlib/speedlim 100;
+#X obj 103 114 mapping/resample 100;
#X obj 103 136 outlet;
#X obj 151 136 inlet;
-#X obj 151 157 maxlib/speedlim 100;
+#X obj 151 157 mapping/resample 100;
#X obj 151 179 outlet;
#X obj 200 179 inlet;
-#X obj 200 200 maxlib/speedlim 100;
+#X obj 200 200 mapping/resample 100;
#X obj 200 222 outlet;
#X obj 247 222 inlet;
-#X obj 247 243 maxlib/speedlim 100;
+#X obj 247 243 mapping/resample 100;
#X obj 247 265 outlet;
#X obj 295 265 inlet;
-#X obj 295 286 maxlib/speedlim 100;
+#X obj 295 286 mapping/resample 100;
#X obj 295 308 outlet;
#X obj 345 308 inlet;
-#X obj 345 329 maxlib/speedlim 100;
+#X obj 345 329 mapping/resample 100;
#X obj 345 351 outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
@@ -485,9 +485,17 @@ Arduino (previously known as Pduino firmware).;
;
#X obj 613 468 tgl 15 0 empty empty 12 0 23 1 12 -232448 -1 -1 0 1
;
-#X obj 631 468 tgl 15 0 empty empty 13 0 23 1 12 -232448 -1 -1 1 1
+#X obj 631 468 tgl 15 0 empty empty 13 0 23 1 12 -232448 -1 -1 0 1
;
#X obj 397 468 tgl 15 0 empty empty 0 4 23 1 12 -232448 -1 -1 0 1;
+#N canvas 0 22 454 304 raw 0;
+#X obj 96 231 outlet;
+#X obj 96 63 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
+-1 -1 2500 1;
+#X msg 90 139 171 \, \$1 \, 0;
+#X connect 1 0 2 0;
+#X connect 2 0 0 0;
+#X restore 374 292 pd raw PWM;
#X connect 4 0 71 0;
#X connect 5 0 4 0;
#X connect 9 0 71 0;
@@ -560,3 +568,4 @@ Arduino (previously known as Pduino firmware).;
#X connect 78 11 89 0;
#X connect 78 12 90 0;
#X connect 78 13 91 0;
+#X connect 93 0 71 1;
diff --git a/arduino.pd b/arduino.pd
index f00a5bc..2210291 100644
--- a/arduino.pd
+++ b/arduino.pd
@@ -1,12 +1,10 @@
-#N canvas 497 22 624 356 10;
-#X obj 323 8 import hardware flatspace iemlib mapping;
-#X text 415 317 released under the GNU GPL;
-#X text 10 317 (C) Copyright 2006 Hans-Christoph Steiner <hans@at.or.at>
-;
-#X obj 11 61 inlet;
-#X obj 10 281 outlet;
-#X obj 494 281 outlet;
-#N canvas 382 102 637 357 command 0;
+#N canvas 602 43 640 372 10;
+#X obj 377 9 import hardware flatspace iemlib mapping;
+#X text 321 336 released under the GNU GPL;
+#X obj 61 19 inlet;
+#X obj 61 297 outlet;
+#X obj 544 297 outlet;
+#N canvas 382 102 653 373 command 0;
#X obj 24 7 inlet;
#X obj 281 289 outlet;
#X obj 210 93 clip 0 1;
@@ -82,14 +80,14 @@ to input;
#X restore 280 93 pd pinMode;
#X obj 139 133 + 160;
#X obj 210 135 + 150;
-#N canvas 291 228 424 356 pwm 0;
+#N canvas 291 228 432 364 pwm 0;
#X obj 44 14 inlet;
#X msg 327 220 251;
#X obj 114 312 outlet;
#X obj 232 185 * 255;
#X obj 232 164 clip 0 1;
#X obj 232 205 int;
-#N canvas 0 22 458 308 list-rev 0;
+#N canvas 0 22 462 312 list-rev 0;
#X obj 92 29 inlet;
#N canvas 0 22 533 407 drip 0;
#X obj 64 206 list split 1;
@@ -157,11 +155,11 @@ to input;
#X connect 14 1 1 0;
#X restore 24 94 pd pwm;
#X msg 359 93 info;
-#X msg 483 118 240;
#X obj 412 91 route digital version;
#X obj 24 51 route pwm analog analogIns digitalIns pinMode info;
#X obj 139 93 clip 0 9;
-#X connect 0 0 12 0;
+#X msg 473 118 249;
+#X connect 0 0 11 0;
#X connect 2 0 3 0;
#X connect 3 0 7 0;
#X connect 4 0 1 0;
@@ -170,73 +168,101 @@ to input;
#X connect 7 0 1 0;
#X connect 8 0 1 0;
#X connect 9 0 1 0;
-#X connect 10 0 1 0;
-#X connect 11 0 4 0;
-#X connect 11 1 10 0;
-#X connect 11 2 1 0;
-#X connect 12 0 8 0;
-#X connect 12 2 13 0;
-#X connect 12 3 2 0;
-#X connect 12 4 5 0;
-#X connect 12 5 9 0;
-#X connect 12 6 11 0;
-#X connect 13 0 6 0;
-#X restore 11 92 pd command processing;
-#X text 257 282 DEBUG/RAW data (this will change);
-#X obj 379 59 inlet;
-#X text 354 40 raw input;
-#X text 10 39 processed input;
-#N canvas 505 101 491 417 make 0;
-#X obj 37 8 inlet;
-#X obj 37 37 moses 128;
-#X obj 65 135 float;
-#N canvas 382 81 514 364 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 10 0 4 0;
+#X connect 10 1 13 0;
+#X connect 10 2 1 0;
+#X connect 11 0 8 0;
+#X connect 11 2 12 0;
+#X connect 11 3 2 0;
+#X connect 11 4 5 0;
+#X connect 11 5 9 0;
+#X connect 11 6 10 0;
+#X connect 12 0 6 0;
+#X connect 13 0 1 0;
+#X restore 61 52 pd command processing;
+#X obj 319 19 inlet;
+#X text 306 1 raw input;
+#X text 57 1 processed input;
+#X obj 61 136 comport \$1 115200;
+#X obj 410 88 loadbang;
+#N canvas 0 22 454 304 report 0;
+#X obj 95 26 inlet;
+#X obj 97 186 print [arduino];
+#X msg 93 87 version_1.0;
+#X connect 0 0 2 0;
+#X connect 2 0 1 0;
+#X restore 410 112 pd report object version;
+#N canvas 0 22 466 316 report 0;
+#X obj 66 7 inlet;
+#X obj 66 36 route open;
+#X obj 66 60 select 1;
+#X obj 67 147 outlet;
+#X msg 66 82 version;
+#X connect 0 0 1 0;
+#X connect 1 0 2 0;
+#X connect 2 0 4 0;
#X connect 4 0 3 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 restore 231 113 pd report firmware version;
+#X text 335 299 DEBUG/RAW data (this will change);
+#N canvas 72 70 439 393 make 0;
+#X obj 79 6 inlet;
+#X obj 184 337 outlet;
+#X obj 79 72 moses 128;
+#X obj 130 96 trigger float float;
+#N canvas 102 52 649 354 set 0;
+#X obj 26 3 inlet;
+#X obj 34 307 outlet;
+#X text 85 31 0xF0;
+#X obj 26 31 moses 240;
+#X text 79 307 length in byte count;
+#X obj 431 254 select 240 247;
+#X text 522 256 SysEx;
+#X msg 291 122 2;
+#X obj 26 60 & 240;
+#X obj 26 101 select 144 160 176 192 208 224;
+#X text 29 86 0x90 0xA0 0xB0 0xC0 0xD0 0xE0;
+#X msg 251 122 2;
+#X text 283 83 0xF4 0xF9;
+#X obj 251 101 select 244 249;
+#X obj 281 199 print [arduino]_WARNING_currently_unsupported;
+#X msg 55 122 160;
+#X msg 26 122 2;
+#X msg 85 122 176;
+#X msg 114 122 1;
+#X msg 144 122 1;
+#X msg 173 122 2;
+#X connect 0 0 3 0;
+#X connect 3 0 8 0;
+#X connect 3 1 13 0;
+#X connect 7 0 1 0;
#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 37 81 pd alternate;
-#X obj 37 114 trigger bang float;
-#X obj 116 61 bang;
-#X obj 131 322 outlet;
-#X obj 223 322 print UNKNOWN_INPUT_COMMAND;
-#X obj 65 155 pack float float float;
-#X obj 65 198 route 240 151;
-#X msg 20 247 version \$2 \$1;
-#N canvas 123 202 614 291 digital 0;
+#X connect 9 1 15 0;
+#X connect 9 2 17 0;
+#X connect 9 3 18 0;
+#X connect 9 4 19 0;
+#X connect 9 5 20 0;
+#X connect 11 0 1 0;
+#X connect 13 0 11 0;
+#X connect 13 1 7 0;
+#X connect 13 2 14 0;
+#X connect 15 0 14 0;
+#X connect 16 0 1 0;
+#X connect 17 0 14 0;
+#X connect 18 0 1 0;
+#X connect 19 0 1 0;
+#X connect 20 0 1 0;
+#X restore 241 123 pd set message length;
+#X obj 184 258 mapping/tolist;
+#X obj 79 210 select 0;
+#X obj 79 188 float;
+#X obj 117 188 - 1;
+#X obj 79 128 trigger bang float;
+#X text 140 72 only process command bytes;
+#N canvas 0 22 470 320 convert 0;
+#X obj 142 218 outlet;
+#X obj 257 218 print UNKNOWN_INPUT_COMMAND;
+#N canvas 123 202 626 303 digital 0;
#X obj 163 16 inlet;
#X obj 252 255 outlet;
#X obj 163 42 unpack float float;
@@ -289,95 +315,76 @@ to input;
#X connect 17 0 4 0;
#X connect 18 0 4 0;
#X connect 19 0 4 0;
-#X restore 123 247 pd digital messages;
-#N canvas 81 317 535 449 analog 0;
-#X obj 85 6 inlet;
-#X obj 63 383 outlet;
-#X obj 85 47 moses 161;
-#X obj 143 65 moses 170;
-#X obj 141 160 list;
-#X obj 385 383 outlet;
-#X msg 347 141 2;
-#X msg 219 141 1;
-#X obj 233 114 trigger bang bang;
-#X msg 63 360 analog \$1 \$2;
-#X obj 63 339 pack float float;
-#X text 241 384 unprocessed messages;
-#X obj 140 241 unpack float float float;
-#X obj 63 114 trigger float bang bang;
-#X obj 303 260 << 7;
-#X obj 221 285 +;
-#X obj 221 306 / 1023;
-#X obj 63 143 - 161;
-#X obj 85 26 trigger anything anything;
-#X obj 386 217 spigot;
-#X obj 423 198 == 2;
-#X obj 140 222 spigot;
-#X obj 177 203 == 1;
-#X obj 254 59 print ANYTHING;
-#X connect 0 0 18 0;
-#X connect 2 0 8 0;
+#X restore 143 114 pd digital messages;
+#N canvas 134 58 331 263 analog 0;
+#X obj 65 6 inlet;
+#X obj 65 203 outlet;
+#X msg 65 180 analog \$1 \$2;
+#X obj 65 159 pack float float;
+#X obj 65 42 unpack float float float;
+#X obj 158 88 +;
+#X obj 158 113 / 1023;
+#X text 203 114 scale to 0-1;
+#X obj 206 63 << 7;
+#X obj 65 63 & 15;
+#X connect 0 0 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 9 0;
+#X connect 4 1 5 0;
+#X connect 4 2 8 0;
+#X connect 5 0 6 0;
+#X connect 6 0 3 1;
+#X connect 8 0 5 1;
+#X connect 9 0 3 0;
+#X restore 286 113 pd analog messages;
+#X obj 85 13 inlet;
+#X msg 40 114 version \$2 \$1;
+#X obj 85 65 route 249 144;
+#X text 114 50 0xF9 0x90;
+#X connect 2 0 0 0;
+#X connect 3 0 0 0;
+#X connect 4 0 6 0;
+#X connect 5 0 0 0;
+#X connect 6 0 5 0;
+#X connect 6 1 2 0;
+#X connect 6 2 3 0;
+#X restore 184 294 pd convert to symbolic commands;
+#X connect 0 0 2 0;
+#X connect 2 0 9 0;
#X connect 2 1 3 0;
-#X connect 3 0 13 0;
-#X connect 3 1 8 0;
-#X connect 4 0 19 0;
-#X connect 4 0 21 0;
-#X connect 6 0 20 0;
-#X connect 6 0 22 0;
-#X connect 7 0 22 0;
-#X connect 7 0 20 0;
-#X connect 8 0 4 0;
-#X connect 8 1 6 0;
-#X connect 9 0 1 0;
-#X connect 10 0 9 0;
-#X connect 12 1 15 0;
-#X connect 12 2 14 0;
-#X connect 13 0 17 0;
-#X connect 13 1 4 0;
-#X connect 13 2 7 0;
-#X connect 14 0 15 1;
-#X connect 15 0 16 0;
-#X connect 16 0 10 1;
-#X connect 17 0 10 0;
-#X connect 18 0 2 0;
-#X connect 18 1 4 1;
-#X connect 19 0 5 0;
-#X connect 20 0 19 1;
-#X connect 21 0 12 0;
-#X connect 22 0 21 1;
-#X restore 266 246 pd analog messages;
+#X connect 3 0 9 0;
+#X connect 3 1 4 0;
+#X connect 4 0 7 1;
+#X connect 5 0 11 0;
+#X connect 6 0 5 1;
+#X connect 7 0 8 0;
+#X connect 7 0 6 0;
+#X connect 8 0 7 1;
+#X connect 9 0 7 0;
+#X connect 9 1 5 0;
+#X connect 11 0 1 0;
+#X restore 62 199 pd make lists;
+#N canvas 0 22 454 304 check 0;
+#X obj 47 62 inlet;
+#X obj 47 88 route version;
+#X obj 47 109 unpack float float;
+#X obj 92 153 print [arduino]_WARNING_INCOMPATIBLE_FIRMWARE_VERSION
+;
+#X obj 47 131 select 1;
#X connect 0 0 1 0;
-#X connect 1 0 3 0;
-#X connect 1 1 5 0;
-#X connect 1 1 2 1;
-#X connect 2 0 8 0;
-#X connect 3 0 4 0;
-#X connect 3 1 8 2;
-#X connect 4 0 2 0;
-#X connect 4 1 8 1;
-#X connect 5 0 3 1;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 9 1 11 0;
-#X connect 9 2 12 0;
-#X connect 10 0 6 0;
-#X connect 11 0 6 0;
-#X connect 12 0 6 0;
-#X connect 12 1 7 0;
-#X restore 10 205 pd make lists;
-#X obj 288 143 spigot;
-#X obj 319 121 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 125 160 print comport;
-#X obj 11 136 comport \$1 115200;
-#X obj 288 166 print command;
-#X connect 3 0 6 0;
-#X connect 6 0 12 0;
-#X connect 6 0 15 0;
-#X connect 8 0 15 0;
-#X connect 11 0 4 0;
-#X connect 12 0 16 0;
-#X connect 13 0 12 1;
-#X connect 15 0 5 0;
-#X connect 15 0 11 0;
-#X connect 15 1 14 0;
+#X connect 1 0 2 0;
+#X connect 2 0 4 0;
+#X connect 4 1 3 0;
+#X restore 92 242 pd check version;
+#X text 10 337 (C) Copyright 2006 Free Software Foundation;
+#X connect 2 0 5 0;
+#X connect 5 0 9 0;
+#X connect 6 0 9 0;
+#X connect 9 0 4 0;
+#X connect 9 0 14 0;
+#X connect 9 1 12 0;
+#X connect 10 0 11 0;
+#X connect 12 0 5 0;
+#X connect 14 0 15 0;
+#X connect 14 0 3 0;