Problem with Mp3 player and i2c Display (voltage and current)

Today at 05:03 am « Last Edit: Today at 05:33 am by wahjuman28»
Hi guys so I have been doing this project about converging an mp3 player with an sd card with an i2c display

showing the voltage and current I think what I was doing is right, right after I upload it, it is supposedly

be working but the program doesn’t seem to work, I check to verify it but what it says is done compiling. Any

suggestion is welcome. I’m sorry if my grammar doesn’t seem to fit which I am not sure as well because I am

from the Philippines. Thank you guys :slight_smile:

#include <max6675.h>
#include <SD.h> //Lib to read SD card
#include <TMRpcm.h> //Lib to play auido
#include <SPI.h>//SPI lib for SD card
#include<Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#define SD_ChipSelectPin 4 //Chip select is pin number 4
TMRpcm music; //Lib object is named “music”

int analogInput = A1;
int song_number=1;
boolean debounce1=true;
boolean debounce2=true;
boolean play_pause;
float vout = 0.0;
float vin = 0.0;
float R1 = 30000.0; //
float R2 = 7500.0; //
int value = 0;
int analogInputAmps = A5;
int readAmpsADC = 2;
float amps = 0.0;
uint8_t degree[8] = {140,146,146,140,128,128,128,128};
void setup()
{
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin))
{
Serial.println(“SD fail”);
}
music.speakerPin = 9; //Auido out on pin 9
Serial.print(“Voltage”);
lcd.begin(16, 2);
// use Arduino pins
pinMode(analogInput, INPUT);
pinMode(analogInputAmps, INPUT);
pinMode(2, INPUT_PULLUP); //Button 1 with internal pull up to chage track
pinMode(3, INPUT_PULLUP); //Button 2 with internal pull up to play/pause
pinMode(3, INPUT_PULLUP); //Button 2 with internal pull up to fast forward
music.setVolume(5); // 0 to 7. Set volume level
music.quality(1);
// wait for MAX chip to stabilize
delay(500);
}
float fmap(float x, float in_min, float in_max, float out_min, float out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

void loop()
{

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Voltage =”);
value = analogRead(analogInput);
vout = (value * 5.0) / (1024.0); // see text
vin = vout / (R2/(R1+R2));
// go to line #
lcd.print(vin);
lcd.print(" V");
lcd.setCursor(0,1);
readAmpsADC = analogRead(analogInputAmps);
amps = fabs(fmap(readAmpsADC, 0.0, 1023.0, 0.01, 5.0));
lcd.print(“Current”);
lcd.print(amps);
lcd.print(" ");

delay(1000);

// basic readout test, just print the current tem
if (digitalRead(2)==LOW && debounce1 == true) //Button 1 Pressed

song_number++;
if (song_number==5)
{song_number=1;}
debounce1=false;
Serial.println(“KEY PRESSED”);
Serial.print(“song_number=”);
Serial.println(song_number);

if (song_number ==1)
{music.play(“1.wav”,10);} //Play song 1 from 10th second

if (song_number ==2)
{music.play(“2.wav”,33);} //Play song 2 from 33rd second

if (song_number ==3)
{music.play(“3.wav”);} //Play song 3 from start

if (song_number ==4)
{music.play(“4.wav”,25);} //Play song 4 from 25th second

if (digitalRead(3)==LOW && debounce2 == true) //Button 2 Pressed
{
music.pause(); Serial.println(“PLAY / PAUSE”);
debounce2=false;
}

if (digitalRead(2)==HIGH) //Avoid debounce
debounce1=true;

if (digitalRead(3)==HIGH)//Avoid debounce
debounce2=true;

}