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

Prochaine révision
Révision précédente
projets:turntable:accueil [2019/03/21 11:26]
resonance créée
projets:turntable:accueil [2019/04/24 13:35] (Version actuelle)
resonance [Turntable]
Ligne 1: Ligne 1:
 +{{:projets:turntable:btn-rec-scratch.jpg|}}
 +
 ====== Turntable ====== ====== Turntable ======
 +
   * Porteur du projet : resonance   * Porteur du projet : resonance
   * Date : 12/02/2019   * Date : 12/02/2019
   * Licence : libre !   * Licence : libre !
-  * Contexte :  +  * Fichiers Scratch {{ :projets:turntable:scratch.zip |scratch.zip}} 
-  * Fichiers : {{ :projets:turntable:audio-scratch.zip |pd & arduino}}+  * 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.| 
 +=== 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;
  
-===== Principe ===== +} 
-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/tourpour se balader dans une table audio d'un patch puredata. Test réalisé avec un gros roulements a bille de verre - diametre 12cm, trouvé sur un luminaire. +void interrupt()// Interrupt function 
-{{youtube>yCrV8tEK90g?medium}}+{ char i; 
 +  i = digitalReadB_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.1553163986.txt.gz · Dernière modification: 2019/03/21 11:26 de resonance