SHARE
TWEET

Untitled

a guest Jan 12th, 2017 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main (void)
  2. {
  3.     int adc_in;
  4.    
  5. DDRB |= (1<<PB1);
  6.     // LED is an output.
  7.     DDRB |= (1 << LED);  
  8.     DDRB |= (1<<PB0);
  9.     adc_setup();
  10.     pwm_setup();
  11.     PB1 == 0;
  12.  
  13.   while (1) {
  14.         if(!(PINB&(1<<PB0)))
  15.         {
  16.        
  17.             if(!(PINB&(1<<PB0)))
  18.             {
  19.                PB1==0 ;
  20.                 _delay_ms(20);
  21.                 // Get the ADC value
  22.                 adc_in = adc_read();
  23.                 // Now write it to the PWM counter
  24.                 pwm_write(adc_in);
  25.                 _delay_ms(50);
  26.             }
  27.         }
  28.     }
  29.    
  30. }
RAW Paste Data
Top