Papermind

ldr

Dec 29th, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. int led = 3;
  2. void setup(){
  3. pinMode (led, OUTPUT);
  4. Serial.begin(9600);}
  5. void loop(){
  6. int sens = analogRead (A0);
  7. Serial.println(sens);
  8. delay (200);
  9. if (sens <= 500) { //tentukan sendiri untuk nilai
  10. digitalWrite (led, HIGH); }
  11. else {digitalWrite (led, LOW); }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment