aslanyen
Published

Charge 3000

With charge 3000, you will be transported to a baseball stadium with the flip of a switch.

BeginnerFull instructions provided972
Charge 3000

Things used in this project

Hardware components

Arduino LilyPad Main Board
Arduino LilyPad Main Board
×1
Lilypad Arduino USB
SparkFun Lilypad Arduino USB
×1
Battery, 3.7 V
Battery, 3.7 V
×1
Buzzer
Buzzer
×1
LilyPad Slide Switch
SparkFun LilyPad Slide Switch
×1
LilyPad LED White (5pcs)
SparkFun LilyPad LED White (5pcs)
×1
Sewable Conductive Thread
Sewable Conductive Thread
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Testing

Testing after the board was broken apart.

Schematics

Intention Diagram

I took a photo of the inside of my hat and a photo of the LilyPad board. Using Adobe Photoshop, I mapped out how the center input board would connect to the LEDs, buzzer, and switch. The dotted gray lines represent conductive thread.

Code

Embedded Code

Arduino
******************************************************************************/

// Create integer variables for the pins we'll be using

int switchPin = A9;
int BuzzerPin=A3; 
int WhiteLED=A5; 

int n=1000; //declaring the integer this value will change with each song
int DurationOn=n; //declaing integer for later on will be used in stacatto calculations
int DurationRest=n; //declaing integer for later on will be used in stacatto calculations

//sum of x & y should be 1 
float x=.66; //declaring float for time on
float y=.34; //declaring float for time 
 
//note middle C is 4C (B flats & E flats)
  int Note1=233; //3Bb   233Hz
  int Note2=294; //4D    294Hz
  int Note3=330; //4E    330Hz
  int Note4=349; //4F    349Hz
  int Note5=392; //4G    392Hz
  int Note6=440; //4A    440Hz
  int Note7=466; //4Bb   466Hz
  int Note8=523; //5C    523Hz
  int Note9=587; //5D    587Hz
  int Note10=622; //5Eb  622Hz
  int Note11=698; //5F   698Hz

 
void setup()
{
  // Initialize the button and switch pins as inputs with pullups.
  // Pullups keep the inputs from "floating" when a switch or button is open / unpressed.

  pinMode(switchPin, INPUT_PULLUP);

  // Initialize the LED pins as outputs:

  pinMode(BuzzerPin, OUTPUT);
  pinMode(WhiteLED, OUTPUT);
}

void loop()
{
   n=600; //rate at which song progresses
  // This code will read the positions of the button and switch,
  // then use the "if" command to make LEDs follow these states.
  
  // Create variables to store the button and switch input values:

  int switchState;

  // Read and save the states of the button and switch:

  switchState = digitalRead(switchPin);

  // The if-else statement lets you do different things based on different inputs:

  // The button will read as LOW when it's pressed

  if (switchState == LOW) // Check to see if switchState is LOW (switch is on)
  {
    digitalWrite(WhiteLED, HIGH);
  tone(BuzzerPin, 392, n/3);
  delay(n/3);
  digitalWrite(WhiteLED, LOW);
  delay(70);
  
  digitalWrite(WhiteLED, HIGH);
  tone(BuzzerPin, 523, n/3);
  delay(n/3);
  digitalWrite(WhiteLED, LOW);
  delay(70);
  
  digitalWrite(WhiteLED, HIGH);
  tone(BuzzerPin, 659, n/3);
  delay(n/3);
  digitalWrite(WhiteLED, LOW);
  delay(70);
  
  digitalWrite(WhiteLED, HIGH);
  tone(BuzzerPin, 784, n*3/4);
  delay(n*3/4);
  digitalWrite(WhiteLED, LOW);
  delay(70);
  
  digitalWrite(WhiteLED, HIGH);
  tone(BuzzerPin, 659, n/4);
  delay(n/4);
  digitalWrite(WhiteLED, LOW);
  delay(70);
  
  digitalWrite(WhiteLED, HIGH);
  tone(BuzzerPin, 784, n*2);
  delay(n*2);
  digitalWrite(WhiteLED, LOW);
  delay(70);

  }  }

Credits

aslanyen

aslanyen

0 projects • 0 followers

Comments