diff options
Diffstat (limited to 'Pd_firmware/Pd_firmware.pde')
-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]); |