I am quite new to programming so please be patient
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);
}
}
}