Hi, so I have been trying this code out (which was given by our professor for us to try) :
int led[] = {13,12,11,10,9};
int fadeamount = 5;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
for(int x = 0; x<5; x++)
{
for(int brightness=0; brightness < 255; brightness + 5)
{
analogWrite(led[x],brightness);
delay(30);
}
analogWrite(led,0);
for(int brightness=255; brightness>=0; brightness=brightness - 5)
{
analogWrite(led[x],brightness);
delay(30);
}
analogWrite(led[x],0);
}
}
Though these codes are correct, for some reason it just doesn't work. I'm trying to fade out 5 LEDs one by one.
Somehow, this error comes up when I compile it. It uploads but then the effect doesn't show in the Arduino board. I'm using Arduino UNO.
C:\Users\acer\Documents\Arduino\FADE_ROW\FADE_ROW.ino: In function 'void setup()':
C:\Users\acer\Documents\Arduino\FADE_ROW\FADE_ROW.ino:5:20: warning: invalid conversion from 'int*' to 'uint8_t {aka unsigned char}' [-fpermissive]
pinMode(led, OUTPUT);
^
In file included from sketch\FADE_ROW.ino.cpp:1:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:133:6: note: initializing argument 1 of 'void pinMode(uint8_t, uint8_t)'
void pinMode(uint8_t, uint8_t);
^~~~~~~
Can anyone help me? have been trying to search the net for solution but no luck.