From e841e007e0198a88375003a49bad7a1129d2ed38 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 24 Jun 2006 00:41:17 +0000 Subject: 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 --- Pd_firmware/Pd_firmware.pde | 7 +++++-- 1 file 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. */ + transmitByte = transmitByte + ((2^i)*digitalData); } printByte(transmitByte); } @@ -314,6 +316,7 @@ void loop() { for(analogPin=0; analogPin> 7); // bitshift the big stuff into the output byte printByte(analogData % 128); // mod by 32 for the small byte checkForInput(); -- cgit v1.2.1