Update of /cvsroot/pure-data/externals/hardware/arduino/Pd_firmware In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17261
Modified Files: Pd_firmware.pde Log Message: an attempt to fix the bug outlined by Alexandre Quessy; I got it quite wrong the first time, but I think this looks right
Index: Pd_firmware.pde =================================================================== RCS file: /cvsroot/pure-data/externals/hardware/arduino/Pd_firmware/Pd_firmware.pde,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Pd_firmware.pde 24 May 2006 18:41:06 -0000 1.9 --- Pd_firmware.pde 24 Jun 2006 00:41:17 -0000 1.10 *************** *** 17,20 **** --- 17,21 ---- * - 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 *************** *** 130,137 **** } else { - // TODO: get digital in working digitalData = digitalRead(digitalPin); } ! transmitByte = transmitByte + (2^(i+1-startPin)*digitalData); } printByte(transmitByte); --- 131,139 ---- } else { digitalData = digitalRead(digitalPin); } ! /* 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); *************** *** 315,318 **** --- 317,321 ---- 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