RGB/Photoresistor Error Code

Hi, I'm new to the forums here and actually signed up just to ask this question! :slight_smile: All I have on my Arduino are 2 sensors: an RGB LED sensor and a photo-resistor sensor, the former is plugged in to digital pin 8 (red), digital pin 9 (blue), and digital pin 10 (green) and the latter is connected in the analog0 port. What I want to have happen is the light to light up red green and blue when it is dark and turn off when there is light. The code I have is as follows:

const int photocellPin = A0;
const int redPin = 8;
const int greenPin = 10;
const int bluePin = 9;
int outputValue = 0;
void setup()
{
         pinMode(redPin, OUTPUT);
         pinMode(greenPin, OUTPUT);
         pinMode(bluePin, OUTPUT);
         outputValue = analogRead(photocellPin);
}
void loop()
{
          if (outputValue = LOW) {color(255, 0, 0);
          delay(1000);
          color(0, 255, 0);
          delay(1000);
          color(0, 0, 255);
          delay(1000);
          
          }else {color(0, 0, 0);
 }

void color (unsigned char red, unsigned char green, unsigned char blue)
{    
          analogWrite(redPin, red);   
          analogWrite(bluePin, blue); 
          analogWrite(greenPin, green); 
}

And the error codes I'm getting are:

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
sketch_feb01a.ino: In function 'void loop()':
sketch_feb01a:26: error: a function-definition is not allowed here before '{' token
sketch_feb01a:30: error: expected `}' at end of input

And I don't know what is wrong, I feel like all of the code is fine but I've never tried anything like this before, so any help would be appreciated. Thanks! :smiley:

All I have on my Arduino are 2 sensors: an RGB LED sensor and a photo-resistor sensor

An RGB LED is an output device. It can't sense a thing.

sketch_feb01a:26: error: a function-definition is not allowed here before '{' token

So, don't do that.

          if (outputValue = LOW) {color(255, 0, 0);

Wrong. = != ==. ONE statement per line.

          }else {color(0, 0, 0);

Curly braces are like shoes. They come in pairs. Throwing one away is silly.