'analogWrite' output value's range is 0~255.
In the source code, 'i' is changed 0 to 255 and 255 to 0.
So LED brightness would be changed.
const int LED = 9; int i=0; void setup(){ pinMode(LED, OUTPUT); } void loop(){ for(i=0; i< 255; i++){ analogWrite(LED, i); delay(10); } for(i=255; i> 0; --i) { analogWrite(LED, i); delay(10); } }//////
No comments:
Post a Comment