projets:electronic_wind_bell:start

Ceci est une ancienne révision du document !


Electronic Wind Bell

  • Porteur du projet : xiaohan guo user
  • Fichiers utiles : mettre un lien vers un code ou un fichier

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

Case :

  • Nowind : no mp3 reading
  • Little wind : few mp3 play - low audio volume
  • Medium wind : more mp3 play - medium audio volume
  • Little wind : allmp3 play - max audio volume

Electronic Wind Bell

  • Arduino
  • wind sensor (anemometer)
  • mp3 player (arduino) +sd
  • amplifier
  • Speakers
  • Battery

Un code pour débuter :
On branche l'anemometre en A0 (avec resistance en pont diviseur de tension entre le A0 et GND).
Et un buzzer en D9.

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
    pinMode(LED_BUILTIN, OUTPUT);
}
 
// 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:
sensorValue = sensorValue/1024;
sensorValue = sensorValue* -1 + 1;
sensorValue = sensorValue*10*1024;
 
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
 
analogWrite(LED_BUILTIN, sensorValue/2);
 
  if (sensorValue > 50) {
 tone(9, sensorValue*10, 50);
  delay(50);
}
else {
 tone(9, 0, 10);
 delay(120);
}
}

Code pour afficher les images du projet :

{{gallery>?&crop&lightbox}}
  • projets/electronic_wind_bell/start.1603973137.txt.gz
  • Dernière modification: 2020/10/29 13:05
  • de 193.50.164.1