/* Code by Mike4449, may or may have not been done before,I made this from scratch. It has 6 buttons, each with a different frequency, and when you push a button, the red LED will turn off and the green will turn on, then the peizo will make the
said frequency until the button is un pressed, while it is doing this, a 1602 LCD will display SOUND BOARD V1.1 and below that will be the frequency that the peizo is making.It uses 5,136 bytes of storage and 194 bytes of dynamic mem, so it is one of the bulkier
projects that ive made. Enjoy!*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int button1 = 2;
int button2 = 3;
int button3 = 4;
int button4 = 5;
int button5 = 6;
int button6 = 7;
int buzzer = 8;
int led = 9; //green LED
int led2 = 10; //red LED
void setup()
{
lcd.begin(16, 2);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("Made by Mike44449!");
delay(10000);
lcd.setCursor(0, 1);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
delay(2000);
lcd.print("Starting Up...");
delay(4000);
lcd.print("Ready!");
delay(4000);
pinMode(button1,INPUT);
pinMode(button2,INPUT);
pinMode(button3,INPUT);
pinMode(button4,INPUT);
pinMode(button5,INPUT);
pinMode(button6,INPUT);
pinMode(buzzer,OUTPUT);
pinMode(led,OUTPUT);
pinMode(led2,OUTPUT);
}
void loop()
{
if (digitalRead(button1) == HIGH) {
digitalWrite(led2,LOW);
digitalWrite(led,HIGH);
tone(buzzer,440);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("440 Hz");
}
if (digitalRead(button1) == LOW) {
digitalWrite(led2,HIGH);
digitalWrite(led,LOW);
noTone(buzzer);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("SOUND IS OFF");
delay(2000);
}
if (digitalRead(button2) == HIGH) {
digitalWrite(led2,LOW);
digitalWrite(led,HIGH);
tone(buzzer,400);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("400 Hz");
}
if (digitalRead(button2) == LOW) {
digitalWrite(led2,HIGH);
digitalWrite(led,LOW);
noTone(buzzer);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("SOUND IS OFF");
delay(2000);
}
if (digitalRead(button3) == HIGH) {
digitalWrite(led2,LOW);
digitalWrite(led,HIGH);
tone(buzzer,360);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("360 Hz");
}
if (digitalRead(button3) == LOW) {
digitalWrite(led2,HIGH);
digitalWrite(led,LOW);
noTone(buzzer);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("SOUND IS OFF");
delay(2000);
}
if (digitalRead(button4) == HIGH) {
digitalWrite(led2,LOW);
digitalWrite(led,HIGH);
tone(buzzer,320);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("320 Hz");
}
if (digitalRead(button4) == LOW) {
digitalWrite(led2,HIGH);
digitalWrite(led,LOW);
noTone(buzzer);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("SOUND IS OFF");
delay(2000);
}
if (digitalRead(button5) == HIGH) {
digitalWrite(led2,LOW);
digitalWrite(led,HIGH);
tone(buzzer,280);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("280 Hz");
}
if (digitalRead(button5) == LOW) {
digitalWrite(led2,HIGH);
digitalWrite(led,LOW);
noTone(buzzer);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("SOUND IS OFF");
delay(2000);
}
if (digitalRead(button6) == HIGH) {
digitalWrite(led2,LOW);
digitalWrite(led,HIGH);
tone(buzzer,230);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("230 Hz");
}
if (digitalRead(button6) == LOW) {
digitalWrite(led2,HIGH);
digitalWrite(led,LOW);
noTone(buzzer);
lcd.print("SOUND BOARD V1.0");
lcd.setCursor(0, 1);
lcd.print("SOUND IS OFF");
delay(2000);
}
else {
digitalWrite(led2,LOW);
digitalWrite(led,LOW);
}
}
One of my bigger projects, the desription is in the code, you will need some LEDs and their corresponding resistors, preferable red and green LEDs, a peizo buzzer, the Uno, a PC, a cable, and a
1602 or 16x2 LCD non serialized or you will have to change the pins when you initialize the lcd library. Enjoy!