Created
May 4, 2023 11:11
-
-
Save jenschr/dacf60d2c9d2bd4efee85768cd5eab82 to your computer and use it in GitHub Desktop.
Simple sketch to make the baldram/ESP_VS1053_Library work with the Adafruit VS1053 breakout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Wire.h> | |
#include <VS1053.h> | |
#include "SampleMp3.h" | |
// These are the pins used for the breakout example | |
#define BREAKOUT_RESET 9 // VS1053 reset pin (output) | |
#define BREAKOUT_CS 10 // VS1053 chip select pin (output) | |
#define BREAKOUT_DCS 6 // VS1053 Data/command select pin (output) | |
#define CARDCS 4 // Card chip select pin | |
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt | |
#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin | |
#define VOLUME 100 // volume level 0-100 | |
VS1053 player(BREAKOUT_CS, BREAKOUT_DCS, DREQ); | |
void setup() { | |
Serial.begin(115200); | |
// reset the breakout | |
pinMode(BREAKOUT_RESET, OUTPUT); | |
digitalWrite(BREAKOUT_RESET, LOW); | |
delay(500); | |
digitalWrite(BREAKOUT_RESET, HIGH); | |
// initialize SPI | |
SPI.begin(); | |
delay(6000); | |
Serial.println("Hello VS1053!\n"); | |
// initialize a player | |
player.begin(); | |
player.switchToMp3Mode(); // optional, some boards require this | |
player.setVolume(VOLUME); | |
} | |
void loop() { | |
Serial.println("Playing sound... "); | |
// play mp3 flow each 3s | |
player.playChunk(sampleMp3, sizeof(sampleMp3)); | |
delay(3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment