Today I will show you how you can easily take a few electronics components and add sound effects to the Operation board game to make it more fun and entertaining.
Check us out on Facebook!
Parts List:
#affiliate links#
SCHEMATIC:
ARDUINO Code:
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <JQ6500_Serial.h>
int RN_file;
JQ6500_Serial mp3(8, 9);
#define vibrator 10
int del;
void setup() {
mp3.begin(9600);
mp3.reset();
mp3.setVolume(15);
mp3.setLoopMode(MP3_LOOP_NONE);
pinMode(2, INPUT_PULLUP);
pinMode(vibrator, OUTPUT);
}
void loop() {
if (digitalRead(2) == LOW && mp3.getStatus() != MP3_STATUS_PLAYING)
{
digitalWrite(vibrator, HIGH);
del = random(10,500);
delay(del);
digitalWrite(vibrator, LOW);
del = random(10, 500);
delay(del);
digitalWrite(vibrator, HIGH);
del = random(10, 500);
delay(del);
digitalWrite(vibrator, LOW);
RN_file = random(1, 4);
mp3.playFileByIndexNumber(RN_file);
}
}