safwan092

LDR code DO NOT DELETE ME

Nov 25th, 2018
554
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const int LEDPin = 13;
  2. const int LDRPin = A1;
  3. int sensorValue = 0;
  4.  
  5. void setup () {
  6. pinMode(LEDPin, OUTPUT);
  7. Serial.begin(9600);
  8. }
  9.  
  10. void loop(){
  11. sensorValue = analogRead(LDRPin);
  12. Serial.print("sensor = " );
  13. Serial.println(sensorValue);
  14.  
  15. if(sensorValue<160)
  16. {
  17. digitalWrite(LEDPin, HIGH);
  18. }
  19. else
  20. {
  21. digitalWrite(LEDPin, LOW);
  22. }
  23.  
  24. delay(500);
  25. }
  26. //End of LOOP
RAW Paste Data