MP3 set serial not declared in the scope error

#include <SoftwareSerial.h>
SoftwareSerial mp3 (10, 11); //RX TX
#include <DFMiniMp3.h>
#include <IRremote.h>
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#define receiver_pin 7
unsigned long last;
unsigned long T;
byte sound = 1;
boolean flag = 1;

// Gun Combat Master 2011
static byte magazine = 27; //Magazine Capacity
static int life = 100; //%
#define bullet_velocity 110
#define CombatMasterLife 25

void setup() {
Serial.begin(9600);
mp3.begin(9600);
IrReceiver.begin(receiver_pin);
mp3_set_Serial (Serial);
delay(50);
mp3_set_volume(30);
delay(50);
mp3_set_EQ(0);
delay(50);
lcd.init();
lcd.backlight();
IrSender.begin(3, ENABLE_LED_FEEDBACK);
pinMode(2, OUTPUT);
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
digitalWrite(2, LOW);
lcd.setCursor(1, 0); lcd.print("Combat Master");
lcd.setCursor(4, 1); lcd.print("2011");
mp3_play(6);
delay(3000);
lcd.setCursor(0, 0); lcd.print(" ");
lcd.setCursor(0, 1); lcd.print(" ");
}

uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x25;
uint8_t sRepeats = 1;

void loop() {
boolean button1 = !digitalRead(A0);
boolean button2 = !digitalRead(A1);
if (IrReceiver.decode()) {
if (life > 0) {
if (IrReceiver.decodedIRData.command == 0x25 && millis() - T > 50) {
life -= CombatMasterLife;
mp3_play(4);
lcd.setCursor(0, 1); lcd.print(" ");
lcd.setCursor(0, 0); lcd.print(" ");
T = millis();
}
}
if (IrReceiver.decodedIRData.command == 0x19) {
life = 100;
flag = 1;
lcd.setCursor(0, 0); lcd.print(" ");
lcd.setCursor(0, 1); lcd.print(" ");
}
}

if (button1 == HIGH && millis() - last > bullet_velocity && life > 0) {
if (magazine > 0) {
IrSender.sendNEC(sAddress, sCommand, sRepeats);
}
mp3_play(sound);
magazine --;
last = millis();

}
if (button2 == HIGH && life > 0) {
mp3_play(3);
magazine = 27;
sound = 1;

} else if (button2 == LOW && magazine == 255 && life > 0) {
magazine = 0;
sound = 2;
}

IrReceiver.resume();
if (life <= 0) {
life = 0;
if (life == 0 && millis() - last > 2000) {
lcd.setCursor(0, 0); lcd.print(" ");
lcd.setCursor(0, 1); lcd.print(" ");
lcd.setCursor(3, 0); lcd.print("Game over");
lcd.setCursor(1, 1); lcd.print("Combat Master");

  last = millis();
  if (life == 0 && flag == 1) {
    mp3_play(5);
    flag = 0;
  }
}

} else if (life > 0) {
lcd.setCursor(0, 0); lcd.print("Bullet");
lcd.setCursor(0, 1); lcd.print(magazine);
lcd.setCursor(10, 0); lcd.print("Life");
lcd.setCursor(10, 1); lcd.print(life);
lcd.setCursor(14, 1); lcd.print("%");
}
}

Welcome to the forum

Your topic was MOVED to its current forum category as it is more suitable than the original as it has nothing to do with installation or troubleshooting the IDE

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

I can’t see where your functions that begin mp3_xxx are defined.

Maybe go back to the instructable and look at how they made those calls in their code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.