Skip to content

Instantly share code, notes, and snippets.

@woile
Last active December 18, 2015 15:39
Show Gist options
  • Save woile/5806185 to your computer and use it in GitHub Desktop.
Save woile/5806185 to your computer and use it in GitHub Desktop.
int i;
void main(){
PORTB=0x00; //Inicialización.
TRISB0_bit=0; //RB0 como salida.
PWM1_Init(4000); //Frecuencia PWM.
PWM1_Start();
i = 0;
while (1){
for(i=0; i<1023; i++){
PWM1_Set_Duty(i);
delay_ms(50);
}
for(i=1023; i<0; i--){
PWM1_Set_Duty(i);
delay_ms(50);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment