Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int LED_PIN = 13;
- const int INTERRUPT_PIN = 2;
- int cas = 0;
- //unsigned long previousMillis = 0UL;
- //unsigned long interval = 1000UL;
- void setup() {
- // put your setup code here, to run once:
- pinMode(LED_PIN, OUTPUT);
- pinMode(INTERRUPT_PIN, INPUT_PULLUP);
- attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), resetcasovac, FALLING);
- Serial.begin(9600);
- return run();
- }
- void loop() {
- // put your main code here, to run repeatedly
- }
- void run(){
- for(cas; cas < 30;cas++){
- delay(1000);
- //unsigned long currentMillis = millis();
- //if(currentMillis - previousMillis > interval)
- //{
- //cas++;
- //previousMillis = currentMillis;
- Serial.println(cas);
- //}
- if(cas>20){
- digitalWrite(LED_PIN, HIGH);
- }
- }
- Serial.println("Tlacitko nezmacknuto.");
- }
- void resetcasovac(){
- cas = 0;
- digitalWrite(LED_PIN, LOW);
- Serial.println("Tlacitko zmacknuto.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement