I have a for loop made by my teacher that dims (or brightens) an LED connected to a PIC18F2455. I have to make the code do both, first brighten, then dim it, but my C skills aren't good enough for this. How can I make this happen?
int count=500;
while(1){
for (int i=0; i<count;i++){
LED = 0;
for(int j=0;j<i;j++);
LED = 1;
for (int j=0;j<count-i;j++);
}
}
You can use PWM to set the brightness or You can set the dim and brighten with this way. The second way is you can use this with software like that.
You can play with the ms variable and you can set the brightness.