daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. int ldr = 0;             //analog pin to which LDR is connected
  3. int ldr_value = 0;        //variable to store LDR values
  4.  
  5. void setup()
  6. {
  7.   Serial.begin(9600);   //start te serial monitor
  8. }
  9.  
  10. void loop()
  11. {
  12.   ldr_value = analogRead(ldr);          //reads the LDR values
  13.   Serial.println(ldr_value);           //prints the LDR values to serial monitor
  14.   if(ldr_value>850){
  15.     digitalWrite(13, HIGH);             // set the LED on
  16.   }else{
  17.     digitalWrite(13, LOW);               // set the LED off
  18.   }
  19.   delay(50);                             //wait
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top