Created
September 2, 2020 21:00
-
-
Save shimo164/5662357ea9adf455decec4e09fc700d0 to your computer and use it in GitHub Desktop.
DigiSpark ATTINY85 Micro USB to prevent PC going sleep
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
// DigiMouse Mouse Wiggler | |
// Originally wrote by Jeff White ([email protected]) | |
// MIT License | |
// to write | |
// 1. Start without inserting Digispark. | |
// 2. When you see "Please plug in the device ... " message, insert Degispark. | |
// setting: set "mode" 0 or 1 | |
// see http://digistump.com/wiki/digispark/tutorials/modelbi2c | |
#include "DigiMouse.h" | |
unsigned int mode = 1; //1 or 0: LED is connected pin0 or pin1 depend on model | |
unsigned int moveamount_px = 1; | |
unsigned int time_led_flash = 100; // ms | |
unsigned int time_waitnext = 1000000; // ms | |
void setup() { | |
pinMode(mode, OUTPUT); | |
DigiMouse.begin(); | |
} | |
void LEDon() { | |
digitalWrite(mode, HIGH); | |
} | |
void LEDoff() { | |
digitalWrite(mode, LOW); | |
} | |
void loop() { | |
LEDon(); | |
DigiMouse.moveX(moveamount); | |
DigiMouse.delay(time_led_flash); | |
DigiMouse.moveX(-moveamount); | |
LEDoff(); | |
DigiMouse.delay(time_waitnext); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment