Generating a square wave on Portenta machine control

See the thread on using library functions with Portenta Machine Control:

In this case, if you would like to output a tone on digital pin #2, you would simply use:

tone(PinNameToIndex(PJ_9), NOTE_A4, 1000);
noTone(PinNameToIndex(PJ_9));