Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2022:sgherman:guitar_pedal [2022/05/31 20:30]
cristina.grigore00 [Rezultate Obţinute]
pm:prj2022:sgherman:guitar_pedal [2022/06/02 01:52] (current)
cristina.grigore00 [Bibliografie/Resurse]
Line 49: Line 49:
  
 </​note>​ </​note>​
 +
 +===== Setup =====
 +
 +In etapa de setup, configurez Timer-ul 0 si Timer-ul 2 pe fastPWM 8-bit inverting, prescaler 2. Configurez ADC-ul: tensiunea de referinta la 1.1V si prescaler-ul la 32. 
 +<​code>​
 +void waveformGenerationMode(int pin) {
 +  int timer = getTimer(pin);​ //select Timer 2/0
 +  //setting the waveform generation mode bits WGM to 011 selects fast PWM
 +  int wgm = B011;
 +
 +  //set WGM2:0 = 3 so that counter counts to 0xFF instead of OCR0A
 +  if(timer == 0) {
 +    TCCR0B &= ~(B1 << 3); // clear WGM02 
 +    TCCR0A &= ~B11; // clear WGM01 and WGM00
 +    TCCR0A |= wgm; // set WGM01 and WGM00
 +  } else if(timer == 2) {
 +    TCCR2B &= ~(B1 << 3); // clear WGM23
 +    TCCR2A &= ~B11; // clear WGM21 and WGM20
 +    TCCR2A |= wgm; // set WGM21 and WGM20
 +  } 
 +}
 +</​code>​
 +<​code>​
 + ​analogReference(INTERNAL);​
 +  //set the ADC's prescaler to a low value (32)
 +  ADCSRA &= ~B111; // clear analog prescale
 +  ADCSRA |= B101;
 +  </​code>​
 +===== Input Switch =====
 +
 +Pentru citirea input-ului de la utilizator citesc valoarea de pe pinul A2 pentru pozitia switch-ului rotativ si obtin o valoare discreta(variabila ''​mode''​). pentru fiecare dintre cele 9 pozitii, desi am ales sa implementez doar 2 efecte pentru 2 pozitii din considerente de lipsa de memorie.\\ Variabila ''​fx''​ contine inputul de pe potentiometrul P1 ce ajusteaza intensitatea efectului.
 +<​code>​
 +void readKnobs(){
 +    mode = analogRead(2);​
 +    //dividing by 75 ensures proper discrete values
 +    //for if statements above
 +    mode = mode / 75;
 +   
 +    fx = analogRead(3);​
 +
 +}
 +</​code>​
 +===== Efecte =====
 +Am ales sa implementez 2 efecte: un delay si un bitcrusher.
 +<​code>​
 +    // ***************
 +    // ***Overdrive***
 +    // ***************
 +    if(mode == 13){
 +      value50 = 1 + ((float) fx / (float) 20);    ​
 +      byte input = analogRead(left);​
 +      input = (input * value50); ​
 +      output(input);​
 +    }
 +</​code>​
 +<​code>​
 +    // *************
 +    // ***bitcrush**
 +    // *************
 +    if(mode == 6){
 +      value300 = 1 + ((float) fx / (float) 3);        ​
 +      if(delayed > value300) {  ​
 +        byte input = analogRead(left);​
 +        input = (input >> 6 << 6);
 +        output(left,​ input);
 +        delayed = 0;
 +       ​} ​
 +       ​delayed++;​
 +
 +    }
 +    </​code>​
  
 ===== Rezultate Obţinute ===== ===== Rezultate Obţinute =====
  
-{{:​pm:​prj2022:​sgherman:​guitar.jpg?​nolink&​400 |}}\\ {{:​pm:​prj2022:​sgherman:​img_20220531_190638.jpg?​nolink&​500 |}}\\ {{:​pm:​prj2022:​sgherman:​img_20220531_190828.jpg?​nolink&​500 |}}+{{:​pm:​prj2022:​sgherman:​guitar.jpg?​nolink&​400 |}}\\ {{:​pm:​prj2022:​sgherman:​img_20220531_190638.jpg?​nolink&​700 |}}\\ {{:​pm:​prj2022:​sgherman:​img_20220531_190828.jpg?​nolink&​700 |}}
  
 ===== Concluzii ===== ===== Concluzii =====
Line 58: Line 129:
 ===== Download ===== ===== Download =====
  
-<note tip> + 
-</​note>​+{{:​pm:​prj2022:​sgherman:​arduino_guitar_pedal.zip|}} 
  
 ===== Jurnal ===== ===== Jurnal =====
Line 70: Line 142:
  
 <​note>​ <​note>​
-[[https://​www.instructables.com/​Arduino-Guitar-Pedal/​]] +[[https://​www.instructables.com/​Arduino-Guitar-Pedal/​]]\\ [[https://​www.electrosmash.com/​pedalshield-uno]]
-[[https://​www.electrosmash.com/​pedalshield-uno]]+
 </​note>​ </​note>​
  
-<​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​ +{{:​pm:​prj2022:​sgherman:​arduino_guitar_pedal_1_.pdf|}}
pm/prj2022/sgherman/guitar_pedal.1654018250.txt.gz · Last modified: 2022/05/31 20:30 by cristina.grigore00
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0