Need help with buttonstate I'm creating a program that works like a piano. I have four button, a piezo buzz and an LCD screen. I'm having a little trouble with the buttonstate. 

Here is my program, when I run it the piezo buzz doesn't stop producing sound. The way it's suppose to work is when I push the green button, the piezo is suppose to produce a C sound but it doesn't. Can anyone please tell me what I've done wrong?

code:

#include &lt;LiquidCrystal.h&gt;

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

int buttonyellow = 3; 
int buttonred = 4;
int buttongreen = 5;
int buttonblue = 6;

int C,D,E,F;  
int buzz = 7;

int buttonstate;

void setup()
{
  lcd.begin(16, 2);

  lcd.print("hello, world!");

  Serial.begin(9600);
  pinMode(buttonyellow,INPUT);
  pinMode(buttonred,INPUT);
  pinMode(buttongreen,INPUT);
  pinMode(buttonblue,INPUT);
}

void loop()
{
  lcd.setCursor(0, 1);

  lcd.print(millis() / 1000);

  C = digitalRead(buttonyellow);
  D = digitalRead(buttonred);
  E = digitalRead(buttongreen);
  F = digitalRead(buttonblue);

  buttonstate = digitalRead(C); 
  if(buttonstate == HIGH){ 
    tone(buzz,523); 
  }  else if ( buttonstate == LOW) {
    tone(buzz,1000); 
  }else{
   noTone(buzz); 
  }  
  delay(50); 
}
As jsotola has pointed out, there is a mistake in your code. Remove the line

buttonstate = digitalRead(C)


and replace 

if(buttonstate == HIGH)


with

if(C == HIGH)


Moreover, I suggest you take a look at the debouncing example in order to make the sound "smoother" ie no jitters because of the button