joba-1 / PicoW_A2DP

Bluetooth A2DP Sink to I2S/DAC on a Raspberry Pico W
5 stars 2 forks source link

how to use buttons to control pico play #5

Open LittleDonkey-jr opened 2 months ago

LittleDonkey-jr commented 2 months ago

I tried to add buttons to control the play and pause of music. I added gpio interrupt detection in the main function, but it did not work correctly. Does interrupt conflict with bluetooth? Or I should write this button control somewhere else

joba-1 commented 2 months ago

Interrupts don't conflict with bluetooth, but there are generally many restrictions what you can do in an interrupt. So, e.g. just set a play flag on button press in the interrupt. In main loop check the flag. If it is set, do the play function and reset the flag. That should work.