Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
projets:electronic_wind_bell:start [2020/10/29 13:05] 193.50.164.1 |
projets:electronic_wind_bell:start [2020/10/30 11:41] (Version actuelle) 92.184.102.128 [Références et liens] |
||
|---|---|---|---|
| Ligne 19: | Ligne 19: | ||
| * Maya Dunietz, " | * Maya Dunietz, " | ||
| * Erik Samakh | * Erik Samakh | ||
| - | * | + | * Eol force , Impala Utopia |
| ===== Notes techniques et matériaux ===== | ===== Notes techniques et matériaux ===== | ||
| * Arduino | * Arduino | ||
| * wind sensor (anemometer) | * wind sensor (anemometer) | ||
| - | * mp3 player (arduino) +sd | + | * mp3 player (arduino) +sd |
| * amplifier | * amplifier | ||
| * Speakers | * Speakers | ||
| Ligne 31: | Ligne 31: | ||
| ===== Codes ===== | ===== Codes ===== | ||
| - | Un code pour débuter : \\ | + | * Anemometre branché sur A0 et GND. |
| - | On branche l' | + | * Lecteur mp3 - RX TX sur d11, |
| - | Et un buzzer en D9. | + | ===== Code pour serial mp3 player avec anemometer ===== |
| + | |||
| + | <code c+ ># | ||
| + | #define TX 11 // tx en fait | ||
| + | #define RX 10 // rx en fait | ||
| + | SerialMP3Player mp3(RX,TX); | ||
| - | <code c+> | + | // the setup routine runs once when you press reset: |
| void setup() { | void setup() { | ||
| // initialize serial communication at 9600 bits per second: | // initialize serial communication at 9600 bits per second: | ||
| Serial.begin(9600); | Serial.begin(9600); | ||
| - | pinMode(LED_BUILTIN, OUTPUT); | + | mp3.begin(9600); |
| + | delay(500); | ||
| + | |||
| + | mp3.sendCommand(CMD_SEL_DEV, 0, 2); // | ||
| + | delay(500); // wait for init | ||
| } | } | ||
| Ligne 47: | Ligne 56: | ||
| float sensorValue = analogRead(A0); | float sensorValue = analogRead(A0); | ||
| // print out the value you read: | // print out the value you read: | ||
| - | sensorValue = sensorValue/ | ||
| - | sensorValue = sensorValue* -1 + 1; | ||
| - | sensorValue = sensorValue*10*1024; | ||
| Serial.println(sensorValue); | Serial.println(sensorValue); | ||
| delay(1); | delay(1); | ||
| - | analogWrite(LED_BUILTIN, | + | |
| - | + | mp3.play(); | |
| - | | + | mp3.setVol(sensorValue/5); // audio volume en fonction du vent... |
| - | tone(9, sensorValue*10, 50); | + | delay(10); |
| - | delay(50); | + | |
| } | } | ||
| else { | else { | ||
| - | tone(9, 0, 10); | + | mp3.stop(); // Stop " |
| - | | + | |
| } | } | ||
| } | } | ||