Arduino Lesson 3 RGB LED

Hi I'm trying to upload this code for lesson 3 RGB LED but I constantly get the error message I have pasted below. What am I doing wrong?

Pls help

void setup() {

//Define Pins
#define BLUE 3
#define GREEN 5
#define RED 6

(analogWrite); redValue = 255;
(analogWrite); greenValue = 0;
(analogWrite); blueValue = 0;

//choose a value between 1 and 255 to change the color.

pinMode(RED, OUTPUT);
pinMode(BLUE, OUTPUT);
digitalWrite(RED, HIGH);
digitalWrite(BLUE, LOW);
digitalWrite(GREEN, LOW);


Error message as follows:

Arduino: 1.8.13 (Windows Store (Windows 10), Board: "Arduino Uno"

C:\Users\hrish\Documents\Arduino\sketch_sep05a\sketch_sep05a.ino: In function 'void setup()':

sketch_sep05a:8:16: error: 'redValue' was not declared in this scope

(analogWrite); redValue = 255;


C:\Users\hrish\Documents\Arduino\sketch_sep05a\sketch_sep05a.ino:8:16: note: suggested alternative: 'rename'

(analogWrite); redValue = 255;



sketch_sep05a:9:16: error: 'greenValue' was not declared in this scope

(analogWrite); greenValue = 0;


C:\Users\hrish\Documents\Arduino\sketch_sep05a\sketch_sep05a.ino:9:16: note: suggested alternative: 'rename'

(analogWrite); greenValue = 0;



sketch_sep05a:10:16: error: 'blueValue' was not declared in this scope

(analogWrite); blueValue = 0;


exit status 1

'redValue' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

analogWrite is a function. The way you've put it in patantheses has no meaning. In your setup code you need to daclare your variables. Like this:

int redValue = 255;
int greenValue = 0;
int blueValue = 0;

Does lesson 3 provide the code?

If so, compare the code you wrote with the example.

analogWrite does not belong where you put it and the ‘fornat’ is wrong. You will also have to declare variables like redValue before using them; e.g.

int redValue;

Your code also seems to be missing loop().

And #defines usually don’t go inside functions.

See complete Arduino - RGB LED tutorial