Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 unsigned int current_duty = 0; unsigned int pwm_period = 0; void main() { ADPCFG = 0xFFFF; TRISA = 0x00; TRISB = 0x00; TRISC = 0x00; PORTA = 0x00; PORTB = 0x00; PORTC = 0x00; LATA = 0x00; LATB = 0x00; LATC = 0x00; Delay_ms(200); Unlock_IOLOCK(); PPS_Mapping(2, _OUTPUT, _OC1); PPS_Mapping(3, _OUTPUT, _OC2); Lock_IOLOCK(); pwm_period = PWM_Init(5000, 1, 1, 2); pwm_period = PWM_Init(5000, 2, 1, 3); PWM_Set_Duty(pwm_period / 2, 1); PWM_Set_Duty(pwm_period / 2, 2); PWM_Start(1); Delay_us(250); PWM_Start(2); while(1) { for(current_duty = 0; current_duty < pwm_period; current_duty++) { PWM_Set_Duty(current_duty, 1); PWM_Set_Duty(current_duty, 2); Delay_ms(10); } } }