Multi-Scale Keyboard Program

I am trying to design a program where there is two scales for a keyboard that plays a tone when a input is pressed. I am using the tone library to get the tone through a speaker. I have got the scale working so far but my problem is I get this error:

Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

Multi-scale_Keyboard.ino: In function 'void loop()':
Multi-scale_Keyboard:24: error: request for member 'begin' in 'tone', which is of non-class type 'void(uint8_t, unsigned int, long unsigned int) {aka void(unsigned char, unsigned int, long unsigned int)}'
Multi-scale_Keyboard:25: error: expected identifier before numeric constant
Multi-scale_Keyboard.ino: In lambda function:
Multi-scale_Keyboard:25: error: expected '{' before ')' token
Multi-scale_Keyboard.ino: In function 'void loop()':
Multi-scale_Keyboard:25: error: 'play' was not declared in this scope
request for member 'begin' in 'tone', which is of non-class type 'void(uint8_t, unsigned int, long unsigned int) {aka void(unsigned char, unsigned int, long unsigned int)}'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Here is my code so far:

#include <Tone.h>

int scalePot = A0;
int C_note = 2;
int D_note = 3;
int E_note = 4;
int F_note = 5;
int G_note = 6;

void setup() {
  // put your setup code here, to run once:
  pinMode (scalePot, INPUT);
  pinMode (C_note, OUTPUT);
  pinMode (D_note, OUTPUT);
  pinMode (E_note, OUTPUT);
  pinMode (F_note, OUTPUT);
  pinMode (G_note, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  while ( 0 < scalePot < 511.5);
  if (C_note = 1);
    tone.begin(2);
    play(261.63,[1]);

  }

Could anybody lend a hand on why I am getting this error. I am new to Arduino so please reply in a simple way as to not over complicate my brain!

if (C_note = 1);

That semicolon's not going to help when you've discovered why "tone" doesn't have a "begin" method.
Nor is the assignment which will ensure the "if" is always true.

while ( 0 < scalePot < 511.5);

There's nothing wrong with that, syntactically, so it won't give you an error, but it probably doesn't do what you intend

tone does have a begin method however! i dowloaded it from here and it says that its one of the methods.

https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation#Methods

Also what i an trying to do with the pot is when its between 0 and 511.5, it plays one scale and for 511.5 to 1023 it plays another scale.

tone does have a begin method however!

No, it has "toneBegin"

Oh my bad, how do i resolve the issue surrounding my while command?

tone begin isn't the method as it doesn't work and says it wasnt declared. Also it says at the bottom of that page in the example this:

#include <Tone.h>

Tone tone1;

void setup()
{
  tone1.begin(13);
  tone1.play(NOTE_A4);
}

void loop()
{
}
while ( 0 < scalePot < 511.5);

more likely:

while ( scalePot > 0 && scalePot < 511.5);

But because scalePot's value never changes, it's difficult to see what you're trying to achieve.
Is there an "analogRead" missing here?

tone begin isn't the method as it doesn't work and says it wasnt declared

I thought we'd already established that?
Just moving it to a different place changes nothing.

In the example you posted, the below line is important.

Tone tone1;

I have sorted out that error now im getting this error:

Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

Multi-scale_Keyboard.ino: In function 'void loop()':
Multi-scale_Keyboard:27: error: expected identifier before numeric constant
Multi-scale_Keyboard.ino: In lambda function:
Multi-scale_Keyboard:27: error: expected '{' before ')' token
Multi-scale_Keyboard.ino: In function 'void loop()':
Multi-scale_Keyboard:27: error: invalid user-defined conversion from 'loop()::__lambda0' to 'uint32_t {aka long unsigned int}' [-fpermissive]
Multi-scale_Keyboard.ino:27:26: note: candidate is: loop()::__lambda0::operator void (*)()() const <near match>
Multi-scale_Keyboard.ino:27:26: note:   no known conversion for implicit 'this' parameter from 'void (*)()' to 'uint32_t {aka long unsigned int}'
Multi-scale_Keyboard.ino: At global scope:
Multi-scale_Keyboard:29: error: expected declaration before '}' token
expected identifier before numeric constant

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

This is how my code looks now.

#include <Tone.h>
Tone tone1;

int scalePot = A0;
int C_note = 2;
int D_note = 3;
int E_note = 4;
int F_note = 5;
int G_note = 6;

void setup() {
  // put your setup code here, to run once:
  pinMode (scalePot, INPUT);
  pinMode (C_note, OUTPUT);
  pinMode (D_note, OUTPUT);
  pinMode (E_note, OUTPUT);
  pinMode (F_note, OUTPUT);
  pinMode (G_note, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  while ( 0 < scalePot < 511.5);
  if (C_note = 1)
  
   tone1.begin(2);
    tone1.play(261.63, [1]);
  }
}

THANKS YOU GUYS FOR ALL OF THE HELP!!!!!

 tone1.play(261.63, [1]);

What's that?

You still haven't sorted the "while" or the "if".

that is the frequency in hertz of the tone and the duration that it plays for. How am i supposed to sort out the while and for loop? Would you help me please?

I already showed you the "while" construct, and you don't have a "for" loop.

What are the square brackets doing in that "play"?

they are for the duration as shown on the website:

https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation#Methods

int scalePot = A0;
// ... later
while ( 0 < scalePot < 511.5);

scalePot is the pin, what you want is to read the pin with analogRead(scalePot) and compare that result.

There shouldn't be a semicolon after your while (well, unless that's intentional?)

Sort the statement within the while brackets as AWOL told you to do.

tone1.play(261.63, [1]);

don't use brackets there, either omit the second argument completely or give it a duration in millis, for example:

tone1.play( 261, 500 );

oh i understand now, i need to do an analog read to find out the value and then read this into the while loop which will then do what i want. I'll test that now...

its all working now except now its saying that there is no such file or directory called wiring. I'm not even using one called wiring! what's wrong now?

Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino\libraries\Tone\Tone.cpp:26:20: fatal error: wiring.h: No such file or directory
 #include <wiring.h>
                    ^
compilation terminated.
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

You have an old library.
Try finding a more up-to-date version, or edit out the "wiring.h" and put in "Arduino.h".

Edit: Ignore - idiot head in place

If you go down the edit route, when/if you come across "WProgram.h", replace that also with "Arduino.h"

AWOL you LEGEND! it now compiles as i changed wiring.h in tone.cpp to Arduino.

Thanks for your help!