PushButtons in player-sdfat-i2s #1060
-
Good morning, You have the schema of Fritzing to modify here. I would like to try this program with my high school students from Valencia(Spain), the program works well when I press PushButton 1 (Play). Can you check my modification to find the error? You can download the program program here. I post also here: /**
#include "AudioTools.h" const char startFilePath="/"; boolean Valor_Polsador_PlayerCopy; void printMetaData(MetaDataType type, const char* str, int len){ void setup() { // setup output // setup player void loop() {
switch (EstatRetingut) { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I would not introduce separate variables for state management but query or let the player handle it automatically: e.g. after calling stop(), you can still call copy: it's just not doing anything... Whenever you poll pins in a loop and want to act on it you should debounce the result, otherwise you risk that the action is executed multiple times. You could use the AudioActions class that I have added for handling the AudioKit buttons, but it is working with any pin as well. Here is an example how to use it... |
Beta Was this translation helpful? Give feedback.
I would not introduce separate variables for state management but query or let the player handle it automatically: e.g. after calling stop(), you can still call copy: it's just not doing anything...
Whenever you poll pins in a loop and want to act on it you should debounce the result, otherwise you risk that the action is executed multiple times.
You could use the AudioActions class that I have added for handling the AudioKit buttons, but it is working with any pin as well.
Here is an example how to use it...