Last active
March 18, 2016 14:30
-
-
Save MarijnKoesen/ef019862bec8c56101f8 to your computer and use it in GitHub Desktop.
Deploybox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Keyboard.h" | |
#include "Mouse.h" | |
const int ledPin = 9; | |
const int buttonPin = 2; | |
int fadeValue = 0; | |
void setup() { | |
pinMode(buttonPin, INPUT); | |
} | |
void loop() { | |
// if the button state has changed, | |
while (digitalRead(buttonPin) == LOW) { | |
fadeValue -= 5; | |
if (fadeValue <= 0) { | |
fadeValue = 255; | |
} | |
analogWrite(ledPin, fadeValue); | |
delay(10); | |
} | |
//Keyboard.println("Ik ben Henry, ik ben een baas!"); | |
Mouse.press(MOUSE_LEFT); | |
delay(1); | |
Mouse.press(MOUSE_LEFT); | |
// fade out from max to min | |
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) { | |
// sets the value (range from 0 to 255): | |
analogWrite(ledPin, fadeValue); | |
delay(5); | |
} | |
while(1) { | |
delay(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment