Differences

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

Link to this comparison view

pm:prj2022:sgherman:guitar_pedal [2022/06/01 01:44]
cristina.grigore00 [Software Design]
pm:prj2022:sgherman:guitar_pedal [2022/06/02 01:52] (current)
cristina.grigore00 [Bibliografie/Resurse]
Line 52: Line 52:
 ===== Setup ===== ===== Setup =====
  
-In etapa de setup, configurez Timer-ul ​si Timer-ul 2 pe fastPWM 8-bit inverting, ​fara prescale, duty cycle 0. Configurez ADC-ul: tensiunea de referinta la 1.1V si prescaler-ul la 32. +In etapa de setup, configurez Timer-ul ​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 ===== ===== 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 ​P3 ce ajusteaza intensitatea efectului.+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>​ <​code>​
 void readKnobs(){ void readKnobs(){
Line 69: Line 91:
 } }
 </​code>​ </​code>​
-===== Setup =====+===== 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 =====
Line 79: Line 129:
 ===== Download ===== ===== Download =====
  
-<note tip> + 
-</​note>​+{{:​pm:​prj2022:​sgherman:​arduino_guitar_pedal.zip|}} 
  
 ===== Jurnal ===== ===== Jurnal =====
Line 91: 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.1654037079.txt.gz · Last modified: 2022/06/01 01:44 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