Our groups's NIME project involved creating a music box/hand-cranked guitar. For this invention, the original plan was that, once the crank was being operated by hand. The pick at the end of the machine would play the guitar strings on the moving cylinder to create a song. Unfortunately, this wasn't able to be accomplished due to the speed of the original motor being too strong for the 'guitar'. The replacement for this however, was to add a smaller box in its place to the noise instead. And depending on the speed of the crank being operated the sound would have a different rhythm to it.
The original concept modular for our NIME was a machine-operated guitar that acted similar to a hand cranked music box. The mapping used for this involved the circuit playground, along with the servo and an additional motor that is mostly kept inside the box enclosure to make a more clean and simple look. As mentioned before, when the user manually operated the crank to play the guitar it would automatically create music from it. Even though our original concept didn’t go exactly as planned, we believe the end result turned out fine. How about you? What would you do to make this music box/ guitar more like our original vision? Let us know down in the comment section below.
//Libraries
#include <Servo.h>
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
//Position and Increment for movement
int pos = 0;
int inc = 1;
//The little motor
Servo myServo;
//Pin identification / assignment
int switchpin = 7;
int potpin = A4;
//The basic setup
void setup(){
Serial.begin(9600);
CircuitPlayground.begin();
myServo.attach(10);
pinMode(switchpin, INPUT);
//Digital tone to signify that the Arduino is operative
CircuitPlayground.playTone(440, 300);
}
void loop(){
int pot = analogRead(potpin); //Get an analogous read from the potentiometer
if (digitalRead(switchpin)) { //Check for servo
int rotation = map(pot, 0, 1023, 0, 180); //Map potentiometer values to rotation of servo
myServo.write(rotation); //Tell the servo to spin
} else {
if(pos == 0) inc = 1;
if(pos == 180) inc = -1;
pos += inc; //Increase or decrease the rotation target of the servo
myServo.write(pos); // Move to targeted rotation
int rate = map(pot, 0, 1023, 1, 100);
delay(rate);
Serial.println(pot); //Debug
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.