led intensity control using interrupt
- include "mbed.h" AnalogIn pot(p15); InterruptIn button(p5); DigitalOut a(LED1); DigitalOut b(LED2); DigitalOut c(LED3); DigitalOut interu(LED4); PwmOut led1(p22);
void flip() { int i=0; while(i<900000) { interu=1; led1=pot; i++; } interu=0; } int main() { button.rise(&flip); while(1) { a=1;b=1;c=1; for(int i=0;i<2;i++) { a=!a; for(int j=0;j<2;j++) { b=!b; for(int k=0;k<2;k++) { c=!c; wait(1); } } } } }
Please log in to post comments.