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
  • 3
    the power rails are separated in the middle of the breadboard. bridge them with jumper wires
    – Juraj
    Commented Apr 17, 2019 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
    Commented Apr 17, 2019 at 15:42
  • Did you set the contrast correctly (using the potentiometer)?
    – Gerben
    Commented Apr 18, 2019 at 8:58

2 Answers 2

1

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

2
  • Where do I put the wires?
    – Chase
    Commented Apr 17, 2019 at 16:42
  • You need to use a wire to connect the 2 rails. Right where is the bigger separation. Commented Apr 17, 2019 at 19:22
0

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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