Table des matières

Electronic Wind Bell

Note d'intention

Create a enelctronic device with anenometer connected to arduino. Arduino drives several Mp3 readers.

Case :

Electronic Wind Bell

Références et liens

Notes techniques et matériaux

Codes

Code pour serial mp3 player avec anemometer

#include "SerialMP3Player.h"
#define TX 11  // tx en fait
#define RX 10  // rx en fait
SerialMP3Player mp3(RX,TX);
 
// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  mp3.begin(9600);        // start mp3-communication
  delay(500);             // wait for init
 
  mp3.sendCommand(CMD_SEL_DEV, 0, 2);   //select sd-card
  delay(500);             // wait for init
}
 
// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  float sensorValue = analogRead(A0);
  // print out the value you read:
 
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
 
  if (sensorValue > 3) {
 mp3.play();     // Play "hello.mp3". You must hear "Hello World"
  mp3.setVol(sensorValue/5); // audio volume en fonction du vent...
  delay(10);
}
else {
 mp3.stop();     // Stop "hello.mp3". You must hear "Hello World"
 delay(10);
}
}

Photos et médias

Code pour afficher les images du projet :

{{gallery>?&crop&lightbox}}