Wire Buzz

Do you know this game?

Introduction

Have you played this game before? I played this when I was in primary school?. This game just needs a few components to build. I’m not sure if kids nowadays know this game?. So why not make this wire buzz and challenge yourself to finish this game without touching the wire????.

Video

This video will show you how to make a wire buzz using servo on Arduino.

Hardware Preparation

This is the hardware connection and the components needed.

Sample Code

Arduino

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
#define PIEZO 8
#define WIRE 9
#define FINISH 10
#define NOTE_C5 523
#define NOTE_D5 587
#define NOTE_E5 659
#define NOTE_A5 880
#define NOTE_B5 988
int BUZZ = 0;
int WinMelody[] = {NOTE_A5, NOTE_B5, NOTE_C5, NOTE_B5, NOTE_C5, NOTE_D5, NOTE_C5, NOTE_D5, NOTE_E5, NOTE_D5, NOTE_E5, NOTE_E5};
int WinNoteDurations[] = {8,8,8,8,8,8,8,8,8,8,8,8};
#define playWinMelody() playMelody(WinMelody, WinNoteDurations, 12)
char inChar;
String inString;
void playMelody(int *melody, int *noteDurations, int notesLength)
{
for (int thisNote = 0; thisNote < notesLength; thisNote++) {
int noteDuration = 1000 / noteDurations[thisNote];
tone(PIEZO, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(PIEZO);
}
}
void intro() {
lcd.setCursor(3, 0);
lcd.print("BUZZ WIRE");
lcd.setCursor(3, 1);
lcd.print("PLAY NOW..");
delay(2000);
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("BUZZ WIRE");
lcd.setCursor(7, 1);
lcd.print(BUZZ);
}
void setup() {
// put your setup code here, to run once:
pinMode(WIRE, INPUT_PULLUP);
pinMode(FINISH, INPUT_PULLUP);
pinMode(PIEZO, OUTPUT);
lcd.init();
lcd.backlight();
intro();
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(WIRE) == LOW) {
BUZZ = BUZZ + 1;
lcd.setCursor(3, 0);
lcd.print("BUZZ WIRE");
lcd.setCursor(7, 1);
lcd.print(BUZZ);
tone (PIEZO, 1000, 300);
delay(400);
}
else if (digitalRead(WIRE) == HIGH) {
noTone;
}
if (digitalRead(FINISH) == LOW) {
lcd.clear();
lcd.setCursor(1, 0);
lcd.print("CONGRATULATION");
lcd.setCursor(4, 1);
lcd.print("YOU WIN!");
playWinMelody();
delay(3000);
BUZZ = 0;
lcd.clear();
intro();
}
}
view raw wirebuzz.ino hosted with ❤ by GitHub

Thank you

Thank you for reading this tutorial and we hope it helps your project development. If you have any technical inquiry, please post at Cytron Technical Forum.

2 thoughts on “Wire Buzz”

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
DIY Automated Vacuum Cleaner Using REKA:BIT With Micro:bit
Rainbow Spark in Mini House using Maker Uno.
TinyML on Arduino using Edge Impulse
Tutorials of Cytron Technologies Scroll to Top