Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/LocalSettings.php on line 193

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/LocalSettings.php on line 197

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/includes/parser/Parser.php on line 2338

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/includes/parser/Parser.php on line 2338

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/includes/parser/Parser.php on line 2338

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/includes/parser/Parser.php on line 2338

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/includes/parser/Parser.php on line 2338

Warning: putenv() has been disabled for security reasons in /home/users4/d/debrouilloweb/www/wikidebrouillard/includes/parser/Parser.php on line 2338
[ Wikidébrouillard ] Piano arduino 7 notes

Piano arduino 7 notes

De Wikidebrouillard.

(La manipulation)
(La manipulation)
Ligne 37 : Ligne 37 :
'''Code'''
'''Code'''
 +
<pre>
 +
#include <CapacitiveSensor.h>
 +
#define speaker 11
 +
 +
CapacitiveSensor  cs_2_3 = CapacitiveSensor(2,3);       
 +
CapacitiveSensor  cs_2_4 = CapacitiveSensor(2,4);       
 +
CapacitiveSensor  cs_2_5 = CapacitiveSensor(2,5);       
 +
CapacitiveSensor  cs_2_6 = CapacitiveSensor(2,6);       
 +
CapacitiveSensor  cs_2_7 = CapacitiveSensor(2,7);       
 +
CapacitiveSensor  cs_2_8 = CapacitiveSensor(2,8);       
 +
CapacitiveSensor  cs_2_9 = CapacitiveSensor(2,9);       
 +
 +
 +
void setup()                   
 +
{
 +
  cs_2_3.set_CS_AutocaL_Millis(0xFFFFFFFF);   
 +
 
 +
  Serial.begin(9600);
 +
}
 +
 +
void loop()                   
 +
{
 +
  long start = millis();
 +
 
 +
  long total1 =  cs_2_3.capacitiveSensor(60);
 +
  long total2 =  cs_2_4.capacitiveSensor(60);
 +
  long total3 =  cs_2_5.capacitiveSensor(60);
 +
  long total4 =  cs_2_6.capacitiveSensor(60);
 +
  long total5 =  cs_2_7.capacitiveSensor(60);
 +
  long total6 =  cs_2_8.capacitiveSensor(60);
 +
  long total7 =  cs_2_9.capacitiveSensor(60);
 +
 
 +
 +
 +
  Serial.print(millis() - start);     
 +
  Serial.print("\t");                   
 +
 +
  Serial.print(total1);                 
 +
  Serial.print("\t");                   
 +
  Serial.print(total2);                 
 +
  Serial.print("\t");                   
 +
  Serial.print(total3);                 
 +
  Serial.print("\t");                   
 +
  Serial.print(total4);                 
 +
  Serial.print("\t");                   
 +
  Serial.print(total5);                 
 +
  Serial.print("\t");                   
 +
  Serial.print(total6);                 
 +
  Serial.print("\t");                   
 +
  Serial.println(total7);               
 +
                                       
 +
 
 +
 
 +
 
 +
 
 +
  if (total1 > 150) tone(speaker,523);
 +
  if (total2 > 150) tone(speaker,587);
 +
  if (total3 > 150) tone(speaker,659);
 +
  if (total4 > 150) tone(speaker,698);
 +
  if (total5 > 150) tone(speaker,784);
 +
  if (total6 > 150) tone(speaker,880);
 +
  if (total7 > 150) tone(speaker,988);
 +
 
 +
 
 +
  if (total1<=150  &  total2<=150  &  total3<=150 & total4<=150  &  total5<=150  &  total6<=150 &  total7<=150)
 +
    noTone(speaker);
 +
 +
  delay(0);                             
 +
}
 +
</pre>
==='''Que voit-on ?===
==='''Que voit-on ?===

Version du 27 mars 2015 à 15:01

Article incomplet en cours de rédaction
Modèle:Vidéo


Sommaire

Présentation de l'expérience

A travers ce tuto , nous allons vous apprendre à réaliser un piano avec différents matériaux conducteur pour les touches!!! Pas de panique le code informatique vous est donné et commenté. Alors à vos plaques et câblez .

Bon courage à vous !!!!

Matériel

L'expérience

La manipulation

Le piano sous arduino permet la réalisation de 7 notes différentes (ou plus) à l'aide de différents matériaux et d'un buzzer. Pour mettre le code sur l'arduino , suivez les étapes décrites ci-dessous:

Ouvrez le logiciel Arduino Copiez-collez le code donné sous le schéma fritzing dans la fenêtre de l'aide arduino.

Schéma fritzing

Code

#include <CapacitiveSensor.h>
#define speaker 11

CapacitiveSensor   cs_2_3 = CapacitiveSensor(2,3);        
CapacitiveSensor   cs_2_4 = CapacitiveSensor(2,4);        
CapacitiveSensor   cs_2_5 = CapacitiveSensor(2,5);        
CapacitiveSensor   cs_2_6 = CapacitiveSensor(2,6);        
CapacitiveSensor   cs_2_7 = CapacitiveSensor(2,7);        
CapacitiveSensor   cs_2_8 = CapacitiveSensor(2,8);        
CapacitiveSensor   cs_2_9 = CapacitiveSensor(2,9);        


void setup()                    
{
  cs_2_3.set_CS_AutocaL_Millis(0xFFFFFFFF);     
  
  Serial.begin(9600);
}

void loop()                    
{
  long start = millis();
  
  long total1 =  cs_2_3.capacitiveSensor(60);
  long total2 =  cs_2_4.capacitiveSensor(60);
  long total3 =  cs_2_5.capacitiveSensor(60);
  long total4 =  cs_2_6.capacitiveSensor(60);
  long total5 =  cs_2_7.capacitiveSensor(60);
  long total6 =  cs_2_8.capacitiveSensor(60);
  long total7 =  cs_2_9.capacitiveSensor(60);
  


  Serial.print(millis() - start);       
  Serial.print("\t");                    

  Serial.print(total1);                  
  Serial.print("\t");                    
  Serial.print(total2);                  
  Serial.print("\t");                    
  Serial.print(total3);                  
  Serial.print("\t");                    
  Serial.print(total4);                  
  Serial.print("\t");                    
  Serial.print(total5);                  
  Serial.print("\t");                    
  Serial.print(total6);                  
  Serial.print("\t");                    
  Serial.println(total7);                
                                         
  
  
  
  
  if (total1 > 150) tone(speaker,523);
  if (total2 > 150) tone(speaker,587);
  if (total3 > 150) tone(speaker,659);
  if (total4 > 150) tone(speaker,698);
  if (total5 > 150) tone(speaker,784);
  if (total6 > 150) tone(speaker,880);
  if (total7 > 150) tone(speaker,988);
  
  
  if (total1<=150  &  total2<=150  &  total3<=150 & total4<=150  &  total5<=150  &  total6<=150 &  total7<=150)
    noTone(speaker);

  delay(0);                              
}

Que voit-on ?

Quand on appuie sur une touche, une note est émise par le buzzer

Explications

De manière simple

Dans le code à copier dans la logiciel arduino, les notes (fréquences) sont inscrites, ainsi chaque touche possède sa propre note.

Allons plus loin dans l'explication

Développons les concepts scientifiques associés.
Ne pas hésiter à faire des liens avec Wikipédia.

Liens avec d'autres expériences

Expériences sur Wikidébrouillard

Indiquer ici les expériences de Wikidébrouillard.

Autres expériences

Portail des ExplorateursWikidébrouillardLéon DitFLOGPhoto mystèreJ'ai FaitPortraits
AR
FI

Piano arduino 7 notes

Rechercher

Page Discussion Historique
Powered by MediaWiki
Creative Commons - Paternite Partage a l

© Graphisme : Les Petits Débrouillards Grand Ouest (Patrice Guinche - Jessica Romero) | Développement web : Libre Informatique