Thursday, 19 January 2012

When you cover the sensor the light dims.
 the code for this ;


int analogPin = 0;    
                     
int val = 0;          

void setup()
{
  Serial.begin(9600);
  pinMode(11, OUTPUT);
}

void loop()
{
  val = analogRead(analogPin);  
  analogWrite(11, val / 4);
 
 
 
  Serial.println(val);          
}

No comments:

Post a Comment