Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <SdFat.h>
- #include <SdFatUtil.h>
- #include <SFEMP3Shield.h>
- #include <Keypad.h>
- const byte ROWS = 4; //four rows
- const byte COLS = 4; //four columns
- char keys[ROWS][COLS] = {
- {1,2,3,4},
- {5,6,7,8},
- {9,10,11,12},
- {13,14,15,16}
- };
- byte rowPins[ROWS] = {A2,A3,A4,A5}; //connect to the row pinouts of the keypad
- byte colPins[COLS] = {A1,A0,4,5}; //connect to the column pinouts of the keypad
- Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
- SFEMP3Shield MP3player;
- void setup() {
- Serial.begin(9600);
- //start the shield
- MP3player.begin();
- keypad.setDebounceTime(200);
- }
- //do something else now
- void loop() {
- char key = keypad.waitForKey();
- byte play = MP3player.isPlaying();
- while (play == 1){play = MP3player.isPlaying();Serial.println("waiting");}
- MP3player.stopTrack();
- Serial.print("stopping");
- Serial.println(key);
- if (key != NO_KEY){
- Serial.print("playing");
- char result = MP3player.playTrack(1);
- Serial.print("playing");
- Serial.println(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement