20 March 2022

NIME Group 23

For this project, my partner and I were stumped on what to do because we had a lack of material. This drawback forced us to be resourceful with what we had to make everything work according to plan. Originally, we had planned to use a bigger box, but since we had barely any alligator clips, we had to downsize. It fortunately works much better this way because now everything works like a cog on a wheel.

The only alligator clips that we had are attached to the servo  and CPB and since we couldn’t power the breadboard with the CPB without making our jobs harder, we decided to power it with an Uno board and a 9v battery. Through this, we were able to power the potentiometer with a male-to-male wire connecting from the breadboard to the CPB. We had to use the help of gravity to keep the male-end connected to the A2 pin.

How this instrument operates is that the slide switch acts as an automatic switch, which gives the user the ability to add a steady noise or to make their own noise with just the buttons if the switch is turned off. When in either the “on” or “off” position, the user can press the left or right button to create a noise; these buttons also work simultaneously. The potentiometer acts a dial to change the pitch. The change is very subtle, but it is there when you listen closely. The servo acts as an acoustic output. We attached a straightened-out paperclip to the hand of the servo and sandwiched the clip in between two pieces of sandpaper; this causes the paperclip to constantly move side to side, which makes a rather pleasant scrapping noise.

We tried to keep it simple with our signifiers; despite our labels, we left the potentiometer exposed so a user can intuitively assume that it’s meaningful. Another signifier is leaving the CPB exposed, so the user can feel inclined to mess with the interface of the CPB, like the buttons and the switch.  The feedback that a user gets from it is that a noise is immediately made when a button is touched or when the switch is on.

What do you think failed with our idea and what do you suggest we do to fix it?





 #include <Servo.h>

#include <Adafruit_CircuitPlayground.h>

#include <Adafruit_Circuit_Playground.h>


//Code by Gianni Rodriguez and Jewel Ernest


Servo myServo;


//Variables

int pitch = 1;

int servoSpeed = 1;

int servoActive = 0;

int note1Active = 0;

int note2Active = 0;

int note3Active = 0;

int aCurrent = 0;

int aPrevious = 0;

int bCurrent = 0;

int bPrevious = 0;

int pos = 0;

int inc = 2;

int timer = 0;


void setup() {

  pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLDOWN); //Switch

  pinMode(CPLAY_RIGHTBUTTON, INPUT_PULLDOWN); //Button B

  pinMode(CPLAY_LEFTBUTTON, INPUT_PULLDOWN); //Button A


  myServo.attach(A2);


  Serial.begin(9600);

  delay(1000);

  CircuitPlayground.begin();

}


void loop() {

  //When switch is active, note 1 plays and servo turns on

  if (digitalRead(CPLAY_SLIDESWITCHPIN)) {

    note1Active = 1;

    servoActive = 1;

  } else {

    note1Active = 0;

    servoActive = 0;

  }


  if (note1Active == 1) {

    CircuitPlayground.playTone(440 + pitch, 100);

  }


  if (servoActive == 1) {

    if (pos == 0) inc = 5;

    if (pos == 180)inc = -5;

    pos += inc;

    myServo.write(pos);

    int rate = map(servoSpeed, 0 , 1023, 0, 180);

    delay(rate);

  }


  //Potentiometer

  pitch = analogRead(A2);

  pitch = map(pitch, 1, 1024, 1, 255);


  //Servo Speed

  servoSpeed = analogRead(A2);


  //When right button is pressed, turn on note 2

  bCurrent = digitalRead(CPLAY_RIGHTBUTTON);

  if (bCurrent == 1 && bPrevious == 0) {

    if (note2Active == 0) {

      note2Active = 1;

      CircuitPlayground.playTone(831, 100);

      //When right button is released, turn off note 2

    } else {

      note2Active = 0;

    }

  }


  //When left button is pressed, turn on note 3

  aCurrent = digitalRead(CPLAY_LEFTBUTTON);

  if (aCurrent == 1 && aPrevious == 0) {

    if (note3Active == 0) {

      note3Active = 1;

      CircuitPlayground.playTone(587, 100);

      //When left button is released, turn off note 3

    } else {

      note3Active = 0;

    }

  }

}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.