Вы находитесь на странице: 1из 2

#include <LiquidCrystal.

h>
using it in the circuit//

//This tells the code what an LCD is and that we are

// Initialize the library with the pins we're using.


// (Note that you can use different pins if needed.)
// See http://arduino.cc/en/Reference/LiquidCrystal
// for more information:
LiquidCrystal lcd(12,11,5,4,3,2);
LCD is plugged into//

//These are all the pins on the redboard that the

void setup()
{
lcd.begin(16, 2);
//The first number in the coordinate is how many pins the LCD
has, the second is the lowest pin on the redboard//
lcd.clear();

//This clears the message it showed last//

lcd.print("Play a song.");
//This tells the LCD board what to say//
// put your setup code here, to run once:
pinMode(10, OUTPUT);
// This shows which pins have power going from it, and
into the circuit//
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(13, OUTPUT);
pinMode(6, INPUT);

}
void loop()
{
while (digitalRead(10) == HIGH)
//These tell the circuit which buttons play different notes,
each for a quarter of a second//
{
tone(6,130,250);
delay(1000);
//The delay makes sure that the note doesn't continuously play//
}
while (digitalRead(9) == HIGH)

{
tone(6,260,250);
delay(1000);
}
while (digitalRead(8) == HIGH)
{
tone(6,520,250);
delay(1000);
}
while (digitalRead(13) == HIGH)
{
tone(6,1050,250);
delay(1000);
}
}

Вам также может понравиться