error: expected ';' before ':' token

The error is at the end of the code, if i change the break: to break;, i get a vector_7 error.

Arduino: 1.7.4 (Windows 8.1), Board: “Arduino Uno”

Using library IRremote in folder: C:\Users\Mike\Documents\Arduino\libraries\IRremote (legacy)

Using library LiquidCrystal in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal

C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10704 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Users\Mike\Documents\Arduino\libraries\IRremote -IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src C:\Users\Mike\AppData\Local\Temp\build5208315428041240775.tmp\Sound_Keyboard.cpp -o C:\Users\Mike\AppData\Local\Temp\build5208315428041240775.tmp\Sound_Keyboard.cpp.o

Sound_Keyboard.ino: In function ‘void loop()’:

Sound_Keyboard.ino:228:14: error: expected ‘;’ before ‘:’ token

Sound_Keyboard.ino:228:14: error: expected primary-expression before ‘:’ token

Sound_Keyboard.ino:228:14: error: expected ‘;’ before ‘:’ token

Sound_Keyboard.ino:238:14: error: expected ‘;’ before ‘:’ token

Sound_Keyboard.ino:238:14: error: expected primary-expression before ‘:’ token

Sound_Keyboard.ino:238:14: error: expected ‘;’ before ‘:’ token

Error compiling.

/* Code by Mike4449, may or may have not been done before,I made this from scratch. It has 6 buttons, each with a different frequency, and when you push a button, the red LED will turn off and the green will turn on, then the peizo will make the
said frequency until the button is un pressed, while it is doing this, a 1602 LCD will display SOUND BOARD V1.1 and below that will be the frequency that the peizo is making.It is one of the bulkier projects that ive made. Enjoy! 6,648 BYTES, 292 BYTES DYNAMIC*/
#include <IRremote.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int button1 = A0;
int button2 = A1;
int button3 = A2;
int button4 = A3;
int button5 = 6;
int button6 = 8;
int buzzer = 7;
int led = 9;      //green LED
int led2 = 10;  //red LED
int screen = 40;
int setupDelay = 500;
int loopDelay = 2000;
int RECV_PIN = 13;
int digit = 0;

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  irrecv.enableIRIn();
  lcd.begin(16, 2);
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Made by Mike P.!");
  delay(5000);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  delay(2000);
  lcd.setCursor(0, 1);
  lcd.print("Starting Up...");
  delay(2750);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait.");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait..");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait...");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait.");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait..");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait...");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait.");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait..");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait...");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait.");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait..");
  delay(setupDelay);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Please Wait...");
  delay(2000);
  lcd.clear();
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("SETTING UP I/O..");
  delay(3000);
  pinMode(button1,INPUT);
  pinMode(button2,INPUT);
  pinMode(button3,INPUT);
  pinMode(button4,INPUT);
  pinMode(button5,INPUT);
  pinMode(button6,INPUT);
  pinMode(buzzer,OUTPUT);
  pinMode(led,OUTPUT); 
  pinMode(led2,OUTPUT); 
  delay(2500);
  lcd.clear();
  delay(1000);
  lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("Ready!");
  tone(buzzer,440);
  delay(500);
  noTone(buzzer);
 lcd.print("SOUND BOARD V2.3");
}

void loop()
{
  if (digitalRead(button1) == HIGH) {
    delay(screen);
  digitalWrite(led2,LOW);
  digitalWrite(led,HIGH);
  tone(buzzer,440);
  lcd.clear();
    lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("440 Hz");
  }
  if (digitalRead(button2) == HIGH) {
        delay(screen);
  digitalWrite(led2,LOW);
  digitalWrite(led,HIGH);
  tone(buzzer,400);
  lcd.clear();
    lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("400 Hz");
  }
  if (digitalRead(button3) == HIGH) {
        delay(screen);
  digitalWrite(led2,LOW);
  digitalWrite(led,HIGH);
  tone(buzzer,360);
  lcd.clear();
    lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("360 Hz");
  }
  if (digitalRead(button4) == HIGH) {
        delay(screen);
  digitalWrite(led2,LOW);
  digitalWrite(led,HIGH);
  tone(buzzer,320);
  lcd.clear();
    lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("320 Hz");
  }
  if (digitalRead(button5) == HIGH) {
        delay(screen);
  digitalWrite(led2,LOW);
  digitalWrite(led,HIGH);
  tone(buzzer,280);
  lcd.clear();
    lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("280 Hz");
  }
  if (digitalRead(button6) == HIGH) {
        delay(screen);
  digitalWrite(led2,LOW);
  digitalWrite(led,HIGH);
  tone(buzzer,230);
  lcd.clear();
    lcd.print("SOUND BOARD V2.3");
  lcd.setCursor(0, 1);
  lcd.print("230 Hz");
  }
  if(digitalRead(button1) == LOW && digitalRead(button2) == LOW && digitalRead(button3) == LOW && digitalRead(button4) == LOW && digitalRead(button5) == LOW && digitalRead(button6) == LOW) {
    delay(150);
  lcd.clear();
  digitalWrite(led2,HIGH);
  digitalWrite(led,LOW);
  noTone(buzzer);
    lcd.print("SOUND BOARD V2.3d");
  lcd.setCursor(0, 1);
  lcd.print("NO SOUND PLAYING");
  }
  if (irrecv.decode(&results)) {
    switch (results.value)  {
      case 0xFF6897:
        delay(150);
        lcd.clear();
        digitalWrite(led2,HIGH);
        digitalWrite(led,LOW);
        noTone(buzzer);
        lcd.print("SOUND BOARD V2.3d");
        lcd.setCursor(0, 1);
        lcd.print("NO SOUND PLAYING");
        break:
      case 0xFF30CF:
        delay(screen);
        digitalWrite(led2,LOW);
        digitalWrite(led,HIGH);
        tone(buzzer,440);
        lcd.clear();
        lcd.print("SOUND BOARD V2.3");
        lcd.setCursor(0, 1);
        lcd.print("440 Hz");
        break:
    }
        
  }  
}
        break:

??

Pete

now i get Sound_Keyboard.ino:238:14: error: expected ';' before ':' token

It isn't the only one.

Pete

there is only 2 breaks, and i changed both of them to break:

A break should be followed by a semicolon, not a colon.

Ive tried both of them with either ; or :

after changing it to a colon, i got:

C:\Users\Mike\AppData\Local\Temp\build5208315428041240775.tmp/core.a(Tone.cpp.o): In function __vector_7': C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Tone.cpp:536: multiple definition of__vector_7' C:\Users\Mike\AppData\Local\Temp\build5208315428041240775.tmp\IRremote\IRremote.cpp.o:C:\Users\Mike\Documents\Arduino\libraries\IRremote/IRremote.cpp:361: first defined here collect2.exe: error: ld returned 1 exit status Error compiling.

Ive tried both of them with either ; or :

Well, don't.

In which of the examples have you seen a colon used instead of a semicolon?

Well, i have 2 break statements, ive tried both with a colon, both with a semicolon, one with a colon and another with a semicolon and flipped that, all get me no where

The correct answer is that both break statements should have a semicolon and the fact that you still get a compiler error has nothing to do with the semicolons or the break statement. The semicolon problem is fixed but you have another, different problem to solve now. Read the error message. It is telling you that __vector_7 is defined twice, once in the tone library and once in the IRremote library. I presume that this means that they both use the same timer's interrupt vector. I haven't had to deal with this particular problem but no doubt somewhere here has had to fix this one way or another.

Pete

I downloaded the new ToneAC library but I'm out of the house rite now so I haven't installed it, but other people say it fixes the vector 7 problem so when I install it ill tell u whether it works or not

Ok, I did some research and apparently the tone() and the IR library use the same timer, I assume timer 4 becuase timer 4 controls pin 7 which contains the peizo so if I move it around to maybe pin 2, which uses timer 1, it should work, I'm still away from my PC so I will tell you guys if it works

Ok, I did some research and apparently the tone() and the IR library use the same timer, I assume timer 4

Both the tone function which you use https://www.arduino.cc/en/Reference/Tone and IRremote use timer 2.

ToneAC uses timer1 so it should fix your conflict.

I thought that tone library used whatever timer that the pin, the one with a peizo, was controlled by, eg, if it was on pin 7, it uses timer 4, if its in pin 2, it uses timer 1, besides, I’m really trying to avoid toneAC

The Tone library uses Timer 2 as cattledog said. It then uses an interrupt to toggle whichever pin you specify. So the pin you use can be anything. However as https://www.arduino.cc/en/Reference/Tone says:

Use of the tone() function will interfere with PWM output on pins 3 and 11 (on boards other than the Mega).

That’s Timer 2.

Ok, well now I'm confused, I'm not using pin 3 or 11, is this a problem involving the pin I use, or is it a library problem?

The library "claims" interrupt vector "__vector_7" otherwise known as "Timer/Counter2 Compare Match A".

Whether or not you use those pins, or the library uses them, it has a function declaration for it, and now you cannot have another library that also wants to use that interrupt.

In Tone there is:

ISR(TIMER2_COMPA_vect)
{
...
}

There would be a similar declaration in the IRemote library. You can't have both in one sketch. This is not a compile error, it is a linker error.

What if I go into the IR library and change the timer? Or change the timer in tone?

You can do that, but it isn't totally trivial. Normally Timer 0 is used for delay(), millis(), micros(). So that isn't free. Timer 1 is usually free but that is a 16-bit timer. You can do it, but you might need to tweak things a bit.

In fact I have a tone library that uses Timer 1, and does it all in hardware which is smoother anyway:

http://www.gammon.com.au/forum/?id=11504&reply=11#reply11

It doesn't use interrupts, thus the problem with the interrupt vector goes away.