Neutrino-1 / Arduino-Soundpod

An Arduino based MP3 player which uses a 1.3" OLED display and DFPlayer

Home Page:https://www.youtube.com/watch?v=z2o4hmli_10&t=66s

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help Please?

iceywastaken opened this issue · comments

Ok so i know this is dumb but i am not sure if i just have to copy every code and paste it or if there is just one i need, so do you think you could post just all the code entirely for copy and pasting?

Thanks

Download the folder soundpod and open one the file "soundpod.ino" with Arduino IDE, all the necessary files will open along with it. You have to just compile and upload the code

Ok, Thank you so much!
Brandon

the code won't work correctly, when I attempt to compile the sketch there is always something that "isn't declared" or something such as that. could you just reply to this with the code by copy and paste it? because for whatever reason, it won't work correctly which is a pain since I really like the idea and even got custom PCBs printed

Can you send the error message or at least a screenshot of the problem?
Copy paste would make the problem worse. Just make sure you have installed all the library necessary (it's mentioned in the readme file) and compile.

I tried it again but I get the following error: 'flashPage' was not declared in this scope. I am new to all of this and I am not sure how to fix it. Please help.

The following is the code I am using:

#include <Arduino.h>
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
#include <U8g2lib.h>
#include <Wire.h>
#include <EEPROM.h>

SoftwareSerial customSoftwareSerial(12,13);
DFRobotDFPlayerMini myDFPlayer;

U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

const uint8_t leftButton = 2;
const uint8_t selectionButton = 5;
const uint8_t rightButton = 3;

volatile uint8_t sMenuSelection = 2;
volatile uint8_t selection = 1;
volatile bool updateScreen = true;

boolean playing = false;
boolean inSideMenuSelection = true;

// Variables
uint8_t filecounts; // total number of files in current folder
uint8_t foldercounts; // total number of folders on sd-card

uint8_t volume = 20; // current volume (0 .. 30)
uint8_t folder = 1; // current sd-card folder
uint8_t file = 1; // curent file in current folder
uint8_t eq = 0;

uint8_t batteryLevel = 0;
float resistor_ratio_factor = 3.91;
uint8_t mins = 0;
unsigned long lastTimepassed = 0;

void setup(void) {
//Initializing u8g2 library
Serial.begin(9200);
u8g2.begin();
u8g2.firstPage();
do
flashPage();
while(u8g2.nextPage());
pinMode(leftButton,INPUT_PULLUP);
pinMode(rightButton,INPUT_PULLUP);
pinMode(selectionButton,INPUT_PULLUP);

attachInterrupt(digitalPinToInterrupt(leftButton),leftButtonISR, FALLING);
attachInterrupt(digitalPinToInterrupt(rightButton),rightButtonISR, FALLING);

//being hardware serial for debugging
Serial.begin(9600);
//Initializing software serial
customSoftwareSerial.begin(9600);

if (!myDFPlayer.begin(customSoftwareSerial)) //Use softwareSerial to communicate with mp3.
Serial.println(F("Please insert the SD card!"));

volume = EEPROM.read(0);
if(volume > 30)
volume = 30;

eq = EEPROM.read(1);
if(eq > 5)
eq = 5;

file = EEPROM.read(2);
if(file >= 255)
file = 1;

delay(1000);
myDFPlayer.volume(volume); //Set volume value. From 0 to 30
delay(500);
foldercounts = myDFPlayer.readFolderCounts();
startFolderPlay();
//
}

void loop() {
batteryReader();
//Selection button
if(!digitalRead(selectionButton) && inSideMenuSelection)
{
inSideMenuSelection = false;
updateScreen = true;
delay(200);
}
else if(!digitalRead(selectionButton) && !inSideMenuSelection && sMenuSelection == 1)
{
if(selection == 1)
{
if(file > 1)
{
//previous audio
myDFPlayer.previous();
file--;
if(!playing)
playing = true;
EEPROM.write(2, file);
}
}
else if(selection == 2)
{
//pause / play
if(playing)
{
myDFPlayer.pause();
}
else
{
myDFPlayer.start();
}
playing = !playing;
}
else if(selection == 3)
{
//next audio
file++;
myDFPlayer.next();
if(!playing)
playing = true;
EEPROM.write(2, file);
}
else if(selection == 4)
{
//back to side menu
selection = 1;
inSideMenuSelection = true;
}
updateScreen = true;
delay(200);
}else if(!digitalRead(selectionButton) && !inSideMenuSelection && sMenuSelection == 2)
{
if(selection == 1)
{
selection = 2;
myDFPlayer.volume(volume);
EEPROM.write(0, volume);
}
else if(selection == 2)
{
selection = 4;
myDFPlayer.EQ(eq);
EEPROM.write(1, eq);
}
else if(selection == 4)
{
//back to side menu
selection = 1;
inSideMenuSelection = true;
}
updateScreen = true;
delay(200);
}

//Updating the dispaly
if(updateScreen)
{
u8g2.firstPage();
do {
int ch = (sMenuSelection);
switch(ch){
case 1:
player();
break;
case 2:
settings();
break;
default:
Serial.println(F("Default Screen"));
}
updateScreen = false;
}while ( u8g2.nextPage() );
}

// check player status
if (myDFPlayer.available()) {
uint8_t type = myDFPlayer.readType();
int value = myDFPlayer.read();

switch (type) {
  case DFPlayerPlayFinished:
    if (file < filecounts) {
      file++;
      myDFPlayer.playFolder(folder, file);
      EEPROM.write(2, file);
      updateScreen = true;
    }
    break;
  default:
    break;
}

}
}

You have only half the code.

Try these steps to compile and upload the code, don't copy paste

download git for windows

Then run this command to download the code
git clone https://github.com/Neutrino-1/Arduino-Soundpod.git

Finally open the "soundpod.ino" using arduino IDE (it's location : Arduino-Soundpod/soundpod/)
and the remaining files "AudioPlayer.ino" , "Input.ino", "display.ino", will open along with that.
compile and upload the code.

ok, thank you so much. I finally got the code to compile and just need it to upload to my pro mini. Thank you so much for helping me get this to work. When I finish it and older it to the custom PCB I have I'll add the photos to this.

Ok, now I cannot upload the code to the mini pro. May I ask you for help on this? If not then just say so and I will not bother you anymore about this, if so then this is the error message:
Arduino: 1.8.15 (Windows Store 1.8.49.0) (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

Sketch uses 19330 bytes (62%) of program storage space. Maximum is 30720 bytes.

Global variables use 1922 bytes (93%) of dynamic memory, leaving 126 bytes for local variables. Maximum is 2048 bytes.

Low memory available, stability problems may occur.

avrdude: ser_open(): can't open device "\.\COM9": The system cannot find the file specified.

Problem uploading to board. See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.

Invalid library found in C:\Users\Brandon\Documents\Arduino\libraries\U8g2: no headers files (.h) found in C:\Users\Brandon\Documents\Arduino\libraries\U8g2

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

In Arduino IDE under "tools" make sure the following setting are set:

board : Arduino pro mini
Processor : Atmega328P 3.3v 8Mhz
port : Select the COM port where your board is connected

[Note : Check in windows device manager if your board is recognised in your PC]

Ok, it's just a faulty board. I have done everything correctly and I just need to order another board. Thank You for your help.