From 851777a865322fae352938197015e70382a79580 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 27 Aug 2006 03:36:47 +0000 Subject: attempts at getting pwm working again; some cleanups svn path=/trunk/externals/hardware/arduino/; revision=5756 --- Pd_firmware/Pd_firmware.pde | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Pd_firmware') diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde index c17d218..b76f749 100644 --- a/Pd_firmware/Pd_firmware.pde +++ b/Pd_firmware/Pd_firmware.pde @@ -279,22 +279,23 @@ void processInput(byte inputData) { int mask; // a few commands have byte(s) of data following the command - if( waitForData > 0 ) { - storedInputData[waitForData - 1] = inputData; - //analogWrite(waitForPWMData,inputData); + if( waitForData > 0) { waitForData--; + storedInputData[waitForData] = inputData; } else if(executeMultiByteCommand) { //we got everything switch(executeMultiByteCommand) { case ENABLE_PWM: + setPinMode(storedInputData[1],PWM); + analogWrite(storedInputData[1], storedInputData[0]); + break; case DISABLE_PWM: - //PWM 0 on the board is PIN 9 - analogWrite(storedInputData[0] + 9, storedInputData[1]); + setPinMode(storedInputData[0],INPUT); break; case ENABLE_SOFTWARE_PWM: - setPinMode(storedInputData[0],SOFTPWM); - setSoftPwm(storedInputData[0], storedInputData[1]); + setPinMode(storedInputData[1],SOFTPWM); + setSoftPwm(storedInputData[1], storedInputData[0]); break; case DISABLE_SOFTWARE_PWM: disSoftPwm(storedInputData[0]); -- cgit v1.2.1