Simple PWM 10kHz square wave

This is simply a note to self because I didn’t find anything on the web that gave me pointers on how to create a 10Khz 50% duty cycle square wave on the Wio Terminal using the Adafruit ZeroTimer library.

The problem is that the ZeroTimer is for “internal use only”, so only supports Adafruit boards. Specifically, the pin mappings to peripherals is different to the Wio Terminal.

I wanted to use Timer TC4 channel 1 to produce the waveform output. On Adafruit boards, this is A5 (PB9).

On Wio Terminal, this is D1:

So need to replace A5 with D1 in Adafruit_ZeroTimer.cpp

My working code is here(as well as change that needs to be made to Adafruit_ZeroTimer.cpp):

Hi @Raspberry_Pi,

Nice work!

Thank you for sharing with the Wio Terminal community!

Best Regards,
Lakshantha