Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<ezButton.h>
- int ledPin = 13;
- ezButton knap(7);
- bool blinker = false;
- bool ledTilstand = LOW;
- unsigned long nu = 0;
- unsigned long forrige = 0;
- void setup() {
- Serial.begin(9600);
- pinMode(ledPin, OUTPUT);
- }
- void loop() {
- knap.loop();
- if (knap.isPressed()) {
- blinker = !blinker;
- Serial.println("Der trykkes på knappen.");
- }
- if (blinker == true) {
- nu = millis();
- if (nu - forrige > 1000) {
- forrige = nu;
- ledTilstand = !ledTilstand;
- digitalWrite(ledPin, ledTilstand);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement