Go Down

Topic: Project 04 "Serial" does not name a type  (Read 2979 times) previous topic - next topic

ghulse

My compiler delivers this error--"Serial" does not name a type -- for this line:

Serial.print(blueValue);

For the life of me, I cannot see where I went wrong.

Code: [Select]


const int greenLEDPin = 9;
const int redLEDPin = 11;
const int blueLEDPin = 10;
                                                //useful constants
const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;

int redSensorValue = 0;
int greenSensorValue = 0;
int blueSensorValue = 0;
                                                 //variables to store the sensor readings as well as the light level of each LED
int redSensor = 0;
int greenSensor = 0;
int blueSensor = 0;


void setup() {
Serial.begin(9600);
                                                  //setting the direction of the digital pins and setting up the serial port
pinMode(greenLEDPin,OUTPUT);
pinMode(redLEDPin,OUTPUT);
pinMode(blueLEDPin,OUTPUT);
}

void loop() {
redSensorValue = analogRead(redSensorPin);
delay(5);                                         //reading the value of each light sensor
greenSensorValue = analogRead(greenSensorPin);
delay(5);
blueSensorValue = analogRead(blueSensorPin);
}
Serial.print("Raw Sensor Values \t Red: ";
Serial.print(redSensorValue);
Serial.print"\t Green: ")                         //report the sensor readings to the computer
Serial.print(greenSensorValue);
Serial.print"\t Blue: ")
Serial.print(blueSensorValue);

redValue = redSensorValue/4;
greenValue = greenSensorValue/4;                 //Convert the sensor readings from a value between 0 - 1023
blueValue = blueSensorValue/4;                   //to a value between 0 - 255

Serial.print("Mapped Sensor Values \t Red ");
Serial.print(redValue);
Serial.print("\t Green: ");                      //report the calculated LED light levels
Serial.print(greenValue);
Serial.print("\t Blue: ");
Serial.print(blueValue);

analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);            //Set the LED light levels
analogWrite(blueLEDPin, blueValue);
}


dannable

Code: [Select]

blueSensorValue = analogRead(blueSensorPin);
}
Serial.print("Raw Sensor Values \t Red: ";


Are you sure that '}' should be there?
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

ghulse

Code: [Select]

blueSensorValue = analogRead(blueSensorPin);
}
Serial.print("Raw Sensor Values \t Red: ";


Are you sure that '}' should be there?
Thank you so much! Actually, there were a couple of missing parentheses too. I got it working now. Thanks again.

Go Up