Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


projets:turntable:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
projets:turntable:accueil [2019/04/10 17:38]
resonance
projets:turntable:accueil [2019/04/24 13:35] (Version actuelle)
resonance [Turntable]
Ligne 6: Ligne 6:
   * Date : 12/02/2019   * Date : 12/02/2019
   * Licence : libre !   * Licence : libre !
-  * Fichiers : {{ :projets:turntable:audio-scratch.zip |pd & arduino}} +  * Fichiers Scratch : {{ :projets:turntable:scratch.zip |scratch.zip}} 
-  * {{ :projets:turntable:audio-scratchbtn.ino |version btn push}}+  * Fichiers Synth-rockband : {{ :projets:turntable:synth-rockstar6.zip |synth-rockstar6.zip}} 
 +  * 
  
  
-===== =====+===== Test =====
  
-| {{youtube>yCrV8tEK90g?medium}} | Utilisation d'un [[https://www.dfrobot.com/wiki/index.php/Incremental_Photoelectric_Rotary_Encoder_-_400P/R_SKU:_SEN0230#Specification|encoder photo-electrique]] de (400 pas/tour) pour se balader dans une table audio d'un patch puredata. Test réalisé avec un roulements a bille de verre diamètre 12cm, trouvé sur un luminaire, c'est assez agréable.\\ **Pb :** ça marche bien sur pc win / linux, ça marche plus sur la rpi (on dirait que le port serie n'atteint pas pd)... doit y a voir un oublie quelque part... |+| {{youtube>yCrV8tEK90g?medium}} | Utilisation d'un [[https://www.dfrobot.com/wiki/index.php/Incremental_Photoelectric_Rotary_Encoder_-_400P/R_SKU:_SEN0230#Specification|encoder photo-electrique]] de (400 pas/tour) pour se balader dans une table audio d'un patch puredata.
 +=== code arduino === 
 +++++ audio-scratchBtn2.ino | 
 +<code cpp> 
 +/*************************************************** 
 +  Two phase quadrature encoder(Incremental) 
 +* **************************************************** 
 +   To determine motor with encode (CW OR CCW)
  
 +  @author Dong
 +  @version  V1.0
 +  @date  2016-5-26
 +  All above must be included in any redistribution
 +* ****************************************************/
 +#define  A_PHASE 2 // modified 
 +#define  B_PHASE 3
 +double flag_A = 0;  //Assign a value to the token bit
 +double flag_B = 0;  //Assign a value to the token bit
 +double pos = 0;
 +double newpos = 0;
  
 +/** *  */
 +
 +// set pin numbers:
 +const int buttonPin = 8;     // the number of the pushbutton pin
 +const int ledPin =  13;      // the number of the LED pin
 +// variables will change:
 +int buttonState = 0;         // variable for reading the pushbutton status
 +int previousButtonState = 0;
 +
 +
 +void setup() {
 +  // initialize the LED pin as an output:
 +  pinMode(ledPin, OUTPUT);      
 +  // initialize the pushbutton pin as an input:
 +  pinMode(buttonPin, INPUT_PULLUP); 
 +  //
 +  pinMode(A_PHASE, INPUT);
 +  pinMode(B_PHASE, INPUT);
 +  Serial.begin(9600);   //Serial Port Baudrate: 9600
 +  //Interrupt trigger mode: RISING
 +  attachInterrupt(digitalPinToInterrupt( A_PHASE), interrupt, RISING); 
 +  previousButtonState = digitalRead(buttonPin);
 +}
 +void loop() {
 +
 +  if (pos != newpos){
 +  Serial.print("enc ");
 +  Serial.println(pos);
 +  delay(10);// Direction judgement
 +  newpos = pos;
 +  }
 +
 +  //
 +  // read the state of the pushbutton value:
 +  buttonState = digitalRead(buttonPin);
 +
 +  // check if the pushbutton is pressed.
 +  // if it is, the buttonState is HIGH:
 +  if (buttonState == HIGH && previousButtonState == LOW) {     
 +    // turn LED on:    
 +    digitalWrite(ledPin, HIGH);  
 +    Serial.println("btn 1");
 +    delay(20);
 +  } 
 +  if (buttonState == LOW && previousButtonState == HIGH) {     
 +    // turn LED off:    
 +    digitalWrite(ledPin, LOW);  
 +    Serial.println("btn 0");
 +    delay(20);
 +  } 
 +  previousButtonState = buttonState;
 +
 +}
 +void interrupt()// Interrupt function
 +{ char i;
 +  i = digitalRead( B_PHASE);
 +  if (i == 1)
 +  {
 +    flag_A += 1;
 +  }
 +  else
 +  {
 +    flag_B += 1;
 +  }
 +  pos = flag_A - flag_B;
 +}
 +</code>
 +++++
/home/resonancg/www/wiki/data/attic/projets/turntable/accueil.1554910687.txt.gz · Dernière modification: 2019/04/10 17:38 de resonance