Pin - is a variable/constant which specifies the i/o pin to use.
Duty - is a variable/constant (0-255) which specifies analog level.
Cycles - is a variable/constant (0-255) which specifies number of cycles. Each cycle takes about 5ms at 4MHz clock frequency.
Output pwm then return pin to input. This command is historical and hence rarely used.
For pwm control of motors etc. the pwmout command is recommended instead. This pwm command is used to provide 'bursts' of PWM output to generate a pseudo analogue output on the PICAXE pins.
This is achieved with a resistor connected to a capacitor connected to ground; the resistor-capacitor junction being the analog output. As the pin returns to an input after execution, the capacitor's rate of discharge is limited - however PWM should be executed periodically to update/refresh the analog voltage.
Submit Your Own Code!
You must be logged in to submit code examples. Login now.