void setup() {
// put your setup code here, to run once:
}
int light;
int LED;
int AnalogWrite;
void loop() {
// put your main code here, to run repeatedly:
light = sin(PI * 2 * millis() / 1000.0) * 127 + 127;
AnalogWrite(LED, light);
}
I get a fault code like 'AnalogWrite' cannot be used as a function'
Now it says
exit status 1
'int analogWrite' redeclared as different kind of symbol
I paste it as it looks now!
void setup() {
// put your setup code here, to run once:
}
int light;
int LED;
int analogWrite;
void loop() {
// put your main code here, to run repeatedly:
light = sin(PI * 2 * millis() / 1000.0) * 127 + 127;
analogWrite(LED, light);
}
void setup() {
// put your setup code here, to run once:
}
int light;
int LED;
void loop() {
// put your main code here, to run repeatedly:
light = sin(PI * 2 * millis() / 1000.0) * 127 + 127;
analogWrite(LED, light);
}
Fixed it.
You declared a variable called analogWrite that I have removed.
The IDE takes care of that. If you want to specifiy a function prototype, your code would look something like
void setup() {
// put your setup code here, to run once:
}
int light;
int LED;
int analogWrite(byte pin, byte value);
void loop() {
// put your main code here, to run repeatedly:
light = sin(PI * 2 * millis() / 1000.0) * 127 + 127;
analogWrite(LED, light);
}
As said, the IDE takes care of that (although it can make mistakes).