21. Video Documentation of Working Prototype
The working prototype is basically a combination of the two Arduino technical tutorials, to show the basic function of my final artefact. I couldn't use the red pressy button in the video because the pins don't fit on a breadboard and I don't have access to a soldering iron. It does work when I press the correct pins and then smoosh the button onto the table, but it leaves me without a free hand to take a video.
The video basically shows that I can use different inputs to play different tracks. The final types of input I use might be different - either all touch sensors, or I'll see what kinds of controllers I can find which can match up with the artefact. I might also use conductive paint or foil strips, depending on cost and accessibility.
Code:
#include <CytronEZMP3.h>
CytronEZMP3 mp3;
int touch = 5;
int buttonPin = 6;
int ledPin = 4;
void setup(){
Serial.begin(9600);
if(!mp3.begin(2, 3))
{
Serial.println("Init failed");
while(1);
}
mp3.setVolume(25);
Serial.print("Device: ");
Serial.println(mp3.getCurrentDevice()==1?"U-Disk":"microSD");
Serial.print("Total files: ");
Serial.println(mp3.getTotalFiles());
pinMode(ledPin, OUTPUT);
pinMode(touch, INPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
if(digitalRead(touch)==HIGH) {
digitalWrite(ledPin, HIGH);
Serial.println("1 boop");
mp3.playTrack(1);
}
else{
digitalWrite(ledPin, LOW);
}
if (digitalRead(buttonPin) == HIGH) {
digitalWrite(ledPin, HIGH);
Serial.println("2 boops");
mp3.playTrack(2);
} else {
digitalWrite(ledPin, LOW);
}
}
Code:
#include <CytronEZMP3.h>
CytronEZMP3 mp3;
int touch = 5;
int buttonPin = 6;
int ledPin = 4;
void setup(){
Serial.begin(9600);
if(!mp3.begin(2, 3))
{
Serial.println("Init failed");
while(1);
}
mp3.setVolume(25);
Serial.print("Device: ");
Serial.println(mp3.getCurrentDevice()==1?"U-Disk":"microSD");
Serial.print("Total files: ");
Serial.println(mp3.getTotalFiles());
pinMode(ledPin, OUTPUT);
pinMode(touch, INPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
if(digitalRead(touch)==HIGH) {
digitalWrite(ledPin, HIGH);
Serial.println("1 boop");
mp3.playTrack(1);
}
else{
digitalWrite(ledPin, LOW);
}
if (digitalRead(buttonPin) == HIGH) {
digitalWrite(ledPin, HIGH);
Serial.println("2 boops");
mp3.playTrack(2);
} else {
digitalWrite(ledPin, LOW);
}
}
Comments
Post a Comment