20 March 2022

NIME Team 2

Unfortunately our project lacks an actual complete model due to constraints on resources, so instead is a brief description of what it should have looked like. Conceptually, the project was meant to have five primary "prongs" arranged in a semi-circle sun pattern around the main circuit. This was meant to give it an overall sense of symmetry so that it looked and felt like an actual instrument rather than just a weird gadget. The servo, groundbreakers, and similar pieces of the whole stretch outwards into their own clear sections tied to specific areas of the circuit playground. This presents a clear signifier to the user that each piece is linked to a different part of the circuit playground. Most notably the piece at the bottom-left, the speaker area, is the one that the user will be most focused on and likely go to first (due to basic left-right reading understanding). The parts of the Circuit Playground Express that each piece is tied to goes in a chronological z pattern starting with A1 at the bottom left and proceeding to A4 at the top right. Based on this description, (assuming you had the parts) what would you have done differently in designing this project? 










//Libraries
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
//#include <notes.h>
//A, B, C, D, E, F, G, A
//440, 493.88, 523.25, 587.33, 659.25, 698.46, 783.99, 800

float notes[] = {440, 493.88, 523.25, 587.33, 659.25, 698.46, 783.99, 800};
//float song[] = {400, 392, 349.23, 392, 440, 440, 440};
float song[] = {294.33, 294.33, 587.33, 440, 415, 392, 349, 294, 349, 392};
//float lengths[]= {200, 200, 200, 200, 200, 200, 200};
float lengths[] = {60, 60, 155, 180, 125, 125, 130, 60, 60, 60};
int numNotes = sizeof(song)/sizeof(float);

void setup() {
  // put your setup code here, to run once:
  CircuitPlayground.begin();
  Serial.begin(9600);
  delay(5000);
  pinMode(4, INPUT_PULLDOWN);
  pinMode(5, INPUT_PULLDOWN);

  //set speaker volume
  analogWrite (A0, 255);
}

void loop() {
  // put your main code here, to run repeatedly:
    if(digitalRead(4)) CircuitPlayground.playTone(440, 500);
    if(digitalRead(5)) {
      for(int i = 0; i < numNotes; i++) {
        Serial.println(notes[i]);
        CircuitPlayground.playTone(song[i], lengths[i]);
      }
    }
}

  //Libraries
#include <Servo.h>
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>

Servo myServo;
int pos = 0;
int inc = 1;
int timer = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  delay(1000);
  CircuitPlayground.begin();
  myServo.attach(10);
  pinMode(13, OUTPUT);
  pinMode(4, INPUT_PULLDOWN);
}
void loop() {
  // put your main code here, to run repeatedly:
  
  if(millis() > timer + 15) {
    if(pos == 0) inc = 1;
    if(pos == 180) inc = -1;
    myServo.write(pos);
    pos += inc;
    timer = millis();
    digitalWrite(13, digitalRead(4));
}
}


No comments:

Post a Comment

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