Arduino Programming RGB LED sketch Help?

Hi

I need help with this program that allows a user to control the color of an RGB LED using the numbers 0-255.  While this program successfully allows the user to freely control the LED, I cannot figure out how to put parameters in the RGB_function or Void Loop function that makes it so the user gets an error if they enter an incorrect value (if they go outside the 0-255 range).  Thank you for the help, the photo shows notes

int temp;int redPin = 11;int greenPin = 10;int bluePin = 9;char redLED;char greenLED;char blueLED;     String Message1 = "RBG LED program\n";String Message2 = "Thank you for your inputs\n";String Message3 = "Invalid integer \n";void setup() {  Serial.begin(9600);  pinMode(redPin, OUTPUT);  pinMode(greenPin, OUTPUT);  pinMode(bluePin, OUTPUT);  Serial.println(Message1);  delay(1000);}void RGB_Function(){  delay(50);  Serial.println("please enter RED, GREEN, and BLUE vars");  while(Serial.available() == 0){    }    redLED = Serial.parseInt();    greenLED = Serial.parseInt();    blueLED = Serial.parseInt();    temp = Serial.parseInt();}void loop() {    RGB_Function();    analogWrite(redPin, redLED);    analogWrite(greenPin, greenLED);    analogWrite(bluePin, blueLED);    Serial.println(Message2);    delay(500);      }void setColor(int red, int green, int blue){  #ifdef COMMON_ANODE  red = 255 - red;  green = 255 - green;  blue = 255 - blue;  #endif  analogWrite(redPin, red);  analogWrite(greenPin, green);  analogWrite(bluePin, blue);}

Update:

i tried to put program in, but yahoo didnt upload it correctly, so if you put it in the IDE youll have to edit it.

Attachment image
There are no answers yet.
Be the first to answer this question.