aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-06-27 20:59:24 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-06-27 20:59:24 +0000
commit3cd538e23c612ff8b60a55e26b4c2e2ad256e150 (patch)
treee7fb1be46a7520168dd363b764168201b99120fd
parenta4d9715d0c6954c71b26ee11ade23cd0edfce4d8 (diff)
added the [devices( message to the test patch; applied David Mellis' patch to get things working with Arduino-0008
svn path=/trunk/externals/hardware/arduino/; revision=7801
-rw-r--r--Pd_firmware/Pd_firmware.pde14
-rw-r--r--arduino-test.pd18
2 files changed, 15 insertions, 17 deletions
diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde
index a5b2e55..62affa3 100644
--- a/Pd_firmware/Pd_firmware.pde
+++ b/Pd_firmware/Pd_firmware.pde
@@ -52,7 +52,7 @@
* TODO: use Program Control to load stored profiles from EEPROM
*/
-/* cvs version: $Id: Pd_firmware.pde,v 1.31 2007-04-13 05:28:23 eighthave Exp $ */
+/* cvs version: $Id: Pd_firmware.pde,v 1.32 2007-06-27 20:59:24 eighthave Exp $ */
#include <EEPROM.h>
#include <Firmata.h>
@@ -96,7 +96,7 @@ void outputDigitalBytes(byte pin0_6, byte pin7_13) {
for(i=2; i<TOTAL_DIGITAL_PINS; ++i) { // ignore Rx,Tx pins (0 and 1)
mask = 1 << i;
if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) {
- digitalWrite(i, twoBytesForPorts & mask);
+ digitalWrite(i, twoBytesForPorts & mask ? HIGH : LOW);
}
}
}
@@ -107,12 +107,12 @@ void outputDigitalBytes(byte pin0_6, byte pin7_13) {
void checkDigitalInputs(void) {
if(reportDigitalInputs) {
previousDigitalInputs = digitalInputs;
- digitalInputs = _SFR_IO8(port_to_input[PB]) << 8; // get pins 8-13
- digitalInputs += _SFR_IO8(port_to_input[PD]); // get pins 0-7
+ digitalInputs = PINB << 8; // get pins 8-13
+ digitalInputs += PIND; // get pins 0-7
digitalInputs = digitalInputs &~ digitalPinStatus; // ignore pins set OUTPUT
if(digitalInputs != previousDigitalInputs) {
// TODO: implement more ports as channels for more than 16 digital pins
- Firmata.sendDigital(0, digitalInputs); // port 0 till more are implemented
+ Firmata.sendDigitalPortPair(0, digitalInputs); // port 0 till more are implemented
/* Serial.print(DIGITAL_MESSAGE,BYTE);
Serial.print(digitalInputs % 128, BYTE); // Tx pins 0-6
Serial.print(digitalInputs >> 7, BYTE); // Tx pins 7-13*/
@@ -275,8 +275,6 @@ void pin13strobe(int count, int onInterval, int offInterval) {
void setup() {
byte i;
- Serial.begin(57600); // 9600, 14400, 38400, 57600, 115200
-
// flash the pin 13 with the protocol version
pinMode(13,OUTPUT);
pin13strobe(2,1,4); // separator, a quick burst
@@ -294,8 +292,6 @@ void setup() {
}
// TODO: load state from EEPROM here
- Firmata.printVersion();
-
/* 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. */
diff --git a/arduino-test.pd b/arduino-test.pd
index 1275f98..477489e 100644
--- a/arduino-test.pd
+++ b/arduino-test.pd
@@ -1,4 +1,4 @@
-#N canvas 71 41 670 525 10;
+#N canvas 458 53 674 529 10;
#X obj 512 7 import hardware mapping;
#X obj 323 126 cnv 15 100 22 empty empty empty 20 12 0 14 -253938 -66577
0;
@@ -80,7 +80,7 @@
#X obj 120 61 tgl 15 0 junk_to_hide_inlet junk_to_hide_outlet 4 5 9
1 12 -262130 -1 -1 0 1;
#X obj 135 61 tgl 15 0 junk_to_hide_inlet junk_to_hide_outlet 5 5 9
-1 12 -262130 -1 -1 1 1;
+1 12 -262130 -1 -1 0 1;
#X obj 150 61 tgl 15 0 junk_to_hide_inlet junk_to_hide_outlet 6 5 9
1 12 -262130 -1 -1 0 1;
#X obj 165 61 tgl 15 0 junk_to_hide_inlet junk_to_hide_outlet 7 5 9
@@ -181,7 +181,7 @@
#X text 300 301 <- argument sets port #;
#X msg 62 109 off;
#X obj 40 81 hradio 15 1 0 14 empty empty empty 0 -6 0 8 -176124 -1
--1 11;
+-1 0;
#X text 148 67 7;
#X text 42 67 0;
#X text 189 67 10;
@@ -238,8 +238,8 @@
#X connect 17 0 14 0;
#X restore 41 135 pd pwm;
#X msg 41 157 pwm 11 0;
-#X msg 328 185 info;
-#X msg 367 185 version;
+#X msg 319 175 info;
+#X msg 358 175 version;
#X obj 230 322 spigot;
#X text 13 6 The [arduino] object works with the Firmata firmware for
Arduino (previously known as Pduino firmware).;
@@ -254,7 +254,7 @@ Arduino (previously known as Pduino firmware).;
#X obj 499 87 tgl 15 0 empty empty 10 0 -6 1 12 -260818 -1 -1 0 1;
#X obj 516 87 tgl 15 0 empty empty 11 0 -6 1 12 -260818 -1 -1 0 1;
#X obj 533 87 tgl 15 0 empty empty 12 0 -6 1 12 -260818 -1 -1 0 1;
-#X obj 550 87 tgl 15 0 empty empty 13 0 -6 1 12 -260818 -1 -1 1 1;
+#X obj 550 87 tgl 15 0 empty empty 13 0 -6 1 12 -260818 -1 -1 0 1;
#X text 328 54 turn on output mode for each pin (off=input);
#X msg 329 128 pinMode 13 1;
#N canvas 101 54 475 352 sending 0;
@@ -460,8 +460,8 @@ Arduino (previously known as Pduino firmware).;
#X text 2 494 (C) Copyright 2006 Free Software Foundation;
#N canvas 0 22 451 224 ver 0;
#X obj 23 7 inlet;
-#X obj 250 100 cnv 15 145 17 empty \$0-version_cnv firmata_version_1.0
-4 10 0 12 -203904 -1 0;
+#X obj 250 100 cnv 15 145 17 empty \$0-version_cnv empty 4 10 0 12
+-203904 -1 0;
#X obj 23 157 send \$0-version_cnv;
#X msg 23 132 label \$1;
#X obj 23 52 zexy/makesymbol firmata_version_%s.%s;
@@ -561,6 +561,7 @@ Arduino (previously known as Pduino firmware).;
0;
#X text 454 146 which analogIns to enable:;
#X obj 230 302 arduino 1;
+#X msg 359 198 devices;
#X connect 4 0 100 0;
#X connect 5 0 4 0;
#X connect 5 1 8 0;
@@ -634,3 +635,4 @@ Arduino (previously known as Pduino firmware).;
#X connect 100 0 46 0;
#X connect 100 0 86 0;
#X connect 100 1 18 0;
+#X connect 101 0 100 0;