kissy blushy monster

http://vimeo.com/moogaloop.swf?clip_id=1908400&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1
Kissy Blushy monster from Subalekha Udayasankar on Vimeo

http://picasaweb.google.com/s/c/bin/slideshow.swf

int potPin = 3;
int potVal = 0;

int redPin = 9;   // Red LED,   connected to digital pin 9
int grnPin = 10;  // Green LED, connected to digital pin 10
int bluPin = 11;  // Blue LED,  connected to digital pin 11

int pwr = 13;

int redVal = 0;   // Variables to store the values to send to the pins
int grnVal = 0;
int bluVal = 0;

void setup()
{
  pinMode(redPin, OUTPUT);   // sets the pins as output
  pinMode(grnPin, OUTPUT);   
  pinMode(bluPin, OUTPUT);
  pinMode(pwr,OUTPUT);

}

// Main program
void loop()
{
  potVal = analogRead(potPin);   // read the potentiometer value at the input pin

digitalWrite(pwr,HIGH);

  if (potVal < 341)  // Lowest third of the potentiometer’s range (0-340)
  {                  
    potVal = (potVal * 3) /4; // Normalize to 0-255

    redVal = 256 – potVal;  // Red from full to off
    grnVal = potVal;        // Green from off to full
    bluVal = 1;             // Blue off
  }
  else if (potVal < 682) // Middle third of potentiometer’s range (341-681)
  {
    potVal = ( (potVal-342) * 3) /4; // Normalize to 0-255

    redVal = 1;            // Red off
    grnVal = 256 – potVal; // Green from full to off
    bluVal = potVal;       // Blue from off to full
  }
  else  // Upper third of potentiometer"s range (682-1023)
  {
    potVal = ( (potVal-683) * 3) /4; // Normalize to 0-255

    redVal = potVal;       // Red from off to full
    grnVal = 1;            // Green off
    bluVal = 256 – potVal; // Blue from full to off
  }

  analogWrite(redPin, redVal);   // Write values to LED pins
  analogWrite(grnPin, grnVal);
  analogWrite(bluPin, bluVal); 

/*
digitalWrite(pwr,HIGH);
  digitalWrite(redPin, LOW);   // Write values to LED pins
  digitalWrite(grnPin, LOW);
  digitalWrite(bluPin, LOW);   
*/
}