diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2006-08-27 03:36:47 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2006-08-27 03:36:47 +0000 |
commit | 851777a865322fae352938197015e70382a79580 (patch) | |
tree | 1f9658dd966f461defa30446a12f96e62b1f7a0b /Pd_firmware | |
parent | 98e71838d67246495a3518a23dad428e7bf3a2bb (diff) |
attempts at getting pwm working again; some cleanups
svn path=/trunk/externals/hardware/arduino/; revision=5756
Diffstat (limited to 'Pd_firmware')
-rw-r--r-- | Pd_firmware/Pd_firmware.pde | 15 |
1 files changed, 8 insertions, 7 deletions
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]); |