From d034240b67b12ecd43299eb012c9c55acd3d3150 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 20 May 2006 15:50:48 +0000 Subject: all outputs seem to be working, now its time to test all of the inputs; cleaned up some cruft too svn path=/trunk/externals/hardware/arduino/; revision=5095 --- Pd_firmware/Pd_firmware.pde | 41 ++++++++++++++--------------------------- arduino-help.pd | 28 ++++++++++++++++------------ 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde index 2f703cd..6265f26 100644 --- a/Pd_firmware/Pd_firmware.pde +++ b/Pd_firmware/Pd_firmware.pde @@ -146,10 +146,8 @@ void checkForInput() { // ------------------------------------------------------------------------- void processInput(byte inputData) { - byte i; + int i; int mask; -// byte writeTest; -// byte highDigitalPinStatus; // the PWM commands (230-232) have a byte of data following the command if (waitForPWMData > 0) { @@ -158,45 +156,34 @@ void processInput(byte inputData) { analogWrite(waitForPWMData,inputData); waitForPWMData = 0; } - else if(inputData < 128) { + else if(inputData < 128) { printByte(151); if(firstInputByte) { printByte(160); - printByte(inputData); - // TODO: this section is for digital out... for(i=0; i<7; ++i) { mask = 1 << i; -/* writeTest = digitalPinStatus; -// writeTest = writeTest & mask; -// printByte(writeTest); -// if(writeTest) { -// or -/* if((byte)digitalPinStatus & mask) { -// digitalWrite(i,(inputData & mask) >> i); - printByte(254); - printByte(i); - printByte(mask); - printByte(inputData & mask); - } */ + //printByte(254); + //printByte(i); + //printByte(mask); + if(digitalPinStatus & mask) { + digitalWrite(i, inputData & mask); + //printByte(inputData & mask); + } } firstInputByte = false; } else { printByte(161); - printByte(inputData); // output data for pins 7-13 - //highDigitalPinStatus = digitalPinStatus >> 7; for(i=7; i> 7)); - printByte(inputData & (mask >> 7)); -// printByte(highDigitalPinStatus & mask); + //printByte(inputData & (mask >> 7)); } } } diff --git a/arduino-help.pd b/arduino-help.pd index 0ec5183..a903550 100644 --- a/arduino-help.pd +++ b/arduino-help.pd @@ -1,4 +1,4 @@ -#N canvas 390 0 638 592 10; +#N canvas 386 0 642 596 10; #X obj 478 -14 import cyclone zexy; #X obj 9 25 nbx 6 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 14 -3754 -1 -1 0 256; @@ -55,7 +55,7 @@ 14 -3754 -1 -1 0 256; #X obj 510 5 receive \$0-G; #X obj 395 89 hradio 15 1 0 14 empty empty empty 0 -6 0 8 -262144 -1 --1 9; +-1 6; #X obj 372 90 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X obj 391 162 +; @@ -147,7 +147,7 @@ #X connect 28 0 17 0; #X restore 465 534 pd decode buttons; #X obj 57 70 hsl 128 15 0 1 0 0 empty empty PWM_control_(0-1) -2 -6 -1 10 -225271 -1 -1 800 0; +1 10 -225271 -1 -1 2500 0; #X msg 33 436 bang; #X obj 235 297 arduino 3; #X obj 123 399 select 255; @@ -169,13 +169,16 @@ -1; #X obj 195 136 t b b; #X msg 219 155 2; -#X msg 13 241 255 \, 126 \, 0; -#X msg 114 176 230 \, 1 \, 231 \, 1 \, 214 \, 215 \, 216; -#X msg 14 222 255 \, 127 \, 4; -#X msg 13 201 255 \, 126 \, 8; #X text 504 72 0; #X text 547 73 3; -#X msg 12 293 231 \, 1 \, 223 \, 255 \, 0 \, 12; +#X msg 13 309 231 \, 1 \, 223 \, 255 \, 0 \, 12; +#X msg 18 277 255 \, \$1; +#X obj 17 260 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 64 +64; +#X obj 20 239 metro 500; +#X obj 14 215 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X msg 114 176 230 \, 1 \, 231 \, 1 \, 220; #X connect 4 0 47 0; #X connect 5 0 4 0; #X connect 13 0 12 1; @@ -222,11 +225,12 @@ #X connect 60 0 14 0; #X connect 61 0 47 0; #X connect 62 0 63 0; -#X connect 63 0 66 0; +#X connect 63 0 72 0; #X connect 63 1 64 0; #X connect 64 0 5 0; -#X connect 65 0 47 0; -#X connect 66 0 47 0; #X connect 67 0 47 0; #X connect 68 0 47 0; -#X connect 71 0 47 0; +#X connect 69 0 68 0; +#X connect 70 0 69 0; +#X connect 71 0 70 0; +#X connect 72 0 47 0; -- cgit v1.2.1