Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int cnt = 0;
- int pinInput = 6;
- int pinOutput = 8;
- bool posledno = false;
- void setup() {
- // put your setup code here, to run once:
- pinMode(pinInput, INPUT);
- pinMode(pinOutput, OUTPUT);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- bool sea = digitalRead(pinInput);
- if (sea != posledno) {
- if (sea == false) cnt++;
- posledno = sea;
- }
- if (cnt == 20) {
- digitalWrite(pinOutput, HIGH);
- delay(500);
- digitalWrite(pinOutput, LOW);
- cnt = 0;
- }
- delay(2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement