Fast PWM
Fast PWM works only on pin A0 (digital pin 3) and allows to run PWM on a higher frequency compared to that analogWrite() provides.
Check Z-Uno pinout
zunoFastPWMInit(prescale)
prescale
0 for 4 MHz (timer tick is 0.25 μs) and ZUNO_GPT_SCALE1024 for 31.25 kHz (timer tick is 32 μs)
none
zunoFastPWMSet(low_ticks, high_ticks)
low_ticks
low level time in timer ticks. Ticks depend on the speed set by zunoFastPWMInit()
high_ticks
high level time in timer ticks. Ticks depend on the speed set by zunoFastPWMInit()
none
zunoFastPWMEnable(value)
value
FALSE to turn Fast PWM off and TRUE to turn on
none
After changing parameters of Fast PWM you need to disable and then enable PWM again.
pinMode(A0, OUTPUT);
zunoFastPWMInit(0); // 0 for 4 MHz (tick is 0.25 μs) and ZUNO_GPT_SCALE1024 for 31.25 kHz (tick is 32 μs)
zunoFastPWMSet(100, 100); // Low and high level time in timer ticks.
zunoFastPWMEnable(1); // Start
...
zunoFastPWMEnable(0); // Turn off once not needed anymore