Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int value = analogRead(LDR);
- Serial.println(value);
- c1= value;
- c2= 500-c1; // resta c2 de 1000 ans guarda el resultado en c1
- if (value < 500)
- {
- digitalWrite(pwmPin, HIGH);
- delayMicroseconds(c2);
- digitalWrite(pwmPin, LOW);
- delayMicroseconds(c1);
- }
- if (value > 500)
- {
- digitalWrite(2,LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment