Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int prPin = 2;
- int relayPin = 1;
- int lightLevel;
- void setup() {
- // put your setup code here, to run once:
- pinMode(relayPin, OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- lightLevel = analogRead(prPin);
- Serial.println(lightLevel);
- if (lightLevel > 900)
- {
- digitalWrite(relayPin, HIGH);
- }
- else
- {
- digitalWrite(relayPin, LOW);
- }
- delay(2000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement