Skip to content

Instantly share code, notes, and snippets.

@MarijnKoesen
Last active March 18, 2016 14:30
Show Gist options
  • Save MarijnKoesen/ef019862bec8c56101f8 to your computer and use it in GitHub Desktop.
Save MarijnKoesen/ef019862bec8c56101f8 to your computer and use it in GitHub Desktop.
Deploybox
#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