tone() function not accepted

I am quite new to programming so please be patient :slight_smile:

I am making a timer bomb simulator for a puzzle box project. The goal is to cut the correct 2 (of 5) wires based on previous hints. The program is working just fine. However, when i try to introduce a buzzer and make some beeps, the compiler just refuses to accept. (line 57) I tried the tone function in another scetch and that worked. What am I doing wrong?

#include <TM1637Display.h>
#include <IRremote.h>

const int CLK = 2; //Set the CLK pin connection to the display
const int DIO = 3; //Set the DIO pin connection to the display
const int OrangeWire = 4; //Assign wires to inputs
const int GreenWire = 5; //Assign wires to inputs
const int BlueWire = 6; //Assign wires to inputs
const int WhiteWire = 7; //Assign wires to inputs
const int YellowWire = 8; //Assign wires to inputs
const int TrigBomb = 9; //LED strip
const int Buzzer = 10; //Beep

int ReceivePin = 12;//IR remote receiver
boolean StartUp = 0;
double RemoteInput = 0;
IRrecv irrecv(ReceivePin);
decode_results results;

TM1637Display display(CLK, DIO); //set up the 4-Digit Display.

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();

pinMode(OrangeWire, INPUT_PULLUP);
pinMode(GreenWire, INPUT_PULLUP);
pinMode(BlueWire, INPUT_PULLUP);
pinMode(WhiteWire, INPUT_PULLUP);
pinMode(YellowWire, INPUT_PULLUP);
pinMode(TrigBomb, OUTPUT);
pinMode(Buzzer, OUTPUT);

display.setBrightness(0x0a); //set the diplay to maximum brightness

}

void loop()
{

digitalWrite(TrigBomb, LOW);

int TimeSpeed = 1000;
int NumStep = 3600; //Number of seconds available on puzzle
display.showNumberDec(NumStep); //Display the time left;
if (irrecv.decode(&results))
{
RemoteInput = results.value;
Serial.println (RemoteInput);
if (RemoteInput == 16738455)
{
StartUp = 1;
tone(Buzzer,440,200);
}
irrecv.resume();
}

while (StartUp == 1)
{
RemoteInput = results.value;
if (irrecv.decode(&results))
{
RemoteInput = results.value;
if (RemoteInput == 16718055)
NumStep -= 300;
if (RemoteInput == 16743045)
NumStep += 300;
irrecv.resume();
}
int OrangeWireState = digitalRead(OrangeWire);
int GreenWireState = digitalRead(GreenWire);
int BlueWireState = digitalRead(BlueWire);
int WhiteWireState = digitalRead(WhiteWire);
int YellowWireState = digitalRead(YellowWire);

if (BlueWireState == 1 | WhiteWireState == 1 | YellowWireState == 1)
{
TimeSpeed = 0;
}
else if (OrangeWireState == 1 && GreenWireState == 1 && TimeSpeed != 0)
{
continue;
}
display.showNumberDec(NumStep); //Display the time left;
delay(TimeSpeed); //Countdown speed
NumStep–;
if (NumStep <= 0)
{
display.showNumberDec(NumStep); //Display the time left;
digitalWrite(TrigBomb, HIGH); //Countdown finished, bomb explodes
delay (200);
digitalWrite(TrigBomb, LOW);
delay(200);
digitalWrite(TrigBomb, HIGH);
delay (200);
digitalWrite(TrigBomb, LOW);
delay(200);

StartUp = 0;

delay(5000);

}

}
}

the compiler just refuses to accept. (line 57)

So, the compiler output just a verbal statement, along the lines of "Nope, I won't let you do that", with nothing in writing. I don't think you are going to get past that problem. Might as well just quit now.

If the compiler printed something, show us exactly what the compiler showed you.

This is the output from compiler:

exit status 1
Error compiling for board Arduino/Genuino Uno.

ALL OF IT.

double RemoteInput = 0;

Oops

Please remember to use code tags when posting code

JohnnyBH67:
This is the output from compiler:

exit status 1
Error compiling for board Arduino/Genuino Uno.

yes and if you drag the edge of the output window upwards ?

OOPS sorry!

Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':

(.text+0x0): multiple definition of `__vector_7'

libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

So you need to find yourself another way of making a noise.

since the IRremote is using the something that timer0 needs, try using timer1 for the tone.

Thanks a lot! Working now. I used NewTone instead.

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

The collect2.exe application got it right. There was a linker problem. The IDE then f**ked up and blamed the problem on the compiler.