1

I'm working on this piano project. When I push a button one of the led light is suppose to turn on and a tone comes out of the piezo. The LCD screen is suppose to print out a sentence but I can't get it to work.

Here is a picture of the board ( everything works except the LCD) I think the problems lies in the power supply but I'm not sure. This is the first time I use a big breadboard. Image of the board

Here is my code:

#include <LiquidCrystal.h>

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

int p1 = 1; 
int p2 = 2;
int p3 = 3;
int p4 = 4;

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

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

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


  Serial.begin(9600);
  pinMode(p1,INPUT);
  pinMode(p2,INPUT);
  pinMode(p3,INPUT);
  pinMode(p4,INPUT);


}


void loop()
{

  lcd.setCursor(0, 1);

  lcd.print(millis() / 1000);

  C = digitalRead(p1);
  D = digitalRead(p2);
  E = digitalRead(p3);
  F = digitalRead(p4);



  if(C == 1){ 

    tone(buzz,523); 
  }else if(D == 1){
    tone(buzz,587); 
  }else if(E == 1){
    tone(buzz,659); 
  }else if(F == 1){
    tone(buzz,698); 

  }else{
    noTone(buzz); 
  }  
  delay(50); 
}
  • 3
    the power rails are separated in the middle of the breadboard. bridge them with jumper wires – Juraj Apr 17 '19 at 13:57
  • 1
    According to the picture, RS and E are connected to pin 8 and 9. According to your sketch, RS and E are connected to 13 and 12. – Jot Apr 17 '19 at 15:42
  • Did you set the contrast correctly (using the potentiometer)? – Gerben Apr 18 '19 at 8:58
1

The LCD is not powered, there are 2 separated power rails... use a wire to connect both rails.

|improve this answer|||||
  • Where do I put the wires? – Chase Apr 17 '19 at 16:42
  • You need to use a wire to connect the 2 rails. Right where is the bigger separation. – Rene Ramirez Apr 17 '19 at 19:22
0

the power rails are separated in the middle of the breadboard. bridge them with jumper wires

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.