aboutsummaryrefslogtreecommitdiff
path: root/Pd_firmware
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-06-24 00:41:17 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-06-24 00:41:17 +0000
commite841e007e0198a88375003a49bad7a1129d2ed38 (patch)
tree2c089b16d5512baa913715876b4fb318d49a10f6 /Pd_firmware
parent3dc0f6ca8531f0763477d79d3542a7bc0447ad9e (diff)
an attempt to fix the bug outlined by Alexandre Quessy; I got it quite wrong the first time, but I think this looks right
svn path=/trunk/externals/hardware/arduino/; revision=5290
Diffstat (limited to 'Pd_firmware')
-rw-r--r--Pd_firmware/Pd_firmware.pde7
1 files changed, 5 insertions, 2 deletions
diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde
index e917fe1..3d667b1 100644
--- a/Pd_firmware/Pd_firmware.pde
+++ b/Pd_firmware/Pd_firmware.pde
@@ -16,6 +16,7 @@
*
* - get digitalInput working
* - add pulseIn functionality
+ * - add software PWM for servos, etc
* - redesign protocol to accomodate boards with more I/Os
* - add cycle markers to mark start of analog, digital, pulseIn, and PWM
*/
@@ -129,10 +130,11 @@ void transmitDigitalInput(byte startPin) {
digitalData = 0; // pin set to PWM, don't read
}
else {
- // TODO: get digital in working
digitalData = digitalRead(digitalPin);
}
- transmitByte = transmitByte + (2^(i+1-startPin)*digitalData);
+/* the next line probably needs to be re-thought (i.e. it might not work...) since my
+ first attempt was miserably wrong. <hans@at.or.at> */
+ transmitByte = transmitByte + ((2^i)*digitalData);
}
printByte(transmitByte);
}
@@ -314,6 +316,7 @@ void loop() {
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 >> 7); // bitshift the big stuff into the output byte
printByte(analogData % 128); // mod by 32 for the small byte
checkForInput();