LenShustek / Playtune_poll

A background polyphonic music generator for Arduino, using fast polling
MIT License
15 stars 2 forks source link

Pin definitions for Arduino Nano 33 IoT #3

Open ajtadeo opened 1 month ago

ajtadeo commented 1 month ago

Hello, I'm trying to use your library to play two scores simultaneously on my Nano via piezo buzzers for a circuit on my graduation cap. I was reading the header for the pin definitions and I was wondering if these apply to the 33 IoT? This is a great project and exactly what I was looking for so I'm hoping I'm able to use it.

LenShustek commented 1 month ago

I've not used the Nano 33 IoT, so I don't know if it will work "out of the box". It uses a modern 32-bit Cortex M0 processor, which is very different from the old 8-bit AVX processors that the original Arduinos had.

In order to be fast enough to play music on those slow AVX processors, playtune_poll does direct manipulation of the hardware registers that control the output bits. The Cortex processor certainly has equivalent registers that will do that, but they may be called by different names.

You might get lucky -- try it and see! But at the very least you will have to do the hard work of mapping the numbers of the pins you want to use to the register and bit numbers inside the processor, as described in the .h file. It's quite unlikely that it will be the same as for the Micro, or for the Nano or for the Mega, which are the examples I give.