Created
September 25, 2021 22:59
-
-
Save glennlopez/e45f7eee9ee59f4be06360ce0b5f5b10 to your computer and use it in GitHub Desktop.
PIR Assisted Mouse Ider
This file contains 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 <Mouse.h> | |
int LED = 13; // the pin that the LED is atteched to | |
int PIR = 3; // the pin that the sensor is atteched to | |
void setup() { | |
pinMode(LED, OUTPUT); // initalize LED as an output | |
pinMode(PIR, INPUT); // initialize sensor as an input | |
Serial.begin(9600); // initialize serial | |
} | |
void loop(){ | |
if (digitalRead(PIR) == HIGH) { // check if the sensor is HIGH | |
digitalWrite(LED, HIGH); | |
int i; | |
for (i = 0; i < 2; i++) | |
{ | |
Mouse.move(1,0); | |
delay(25); | |
} | |
for (i=0; i<2; i++) | |
{ | |
Mouse.move(-1, 0); | |
delay(25); | |
} | |
Serial.println("Motion detected!"); | |
delay(100); | |
} | |
else { | |
digitalWrite(LED, LOW); | |
Serial.println("Motion stopped!"); | |
delay(100); | |
} | |
} |
Does this still work?
@glennlopez Yah, I mean can this trick bypass the automatic shutdown of the Shadow PC?
@glennlopez Thanks for the reply. So, running this script on the Shadow PC won't work, it has to be run on the host computer, right?
@glennlopez Oh, I see...I will dig into these, thanks again.
@glennlopez Oh, you are so kind, bro. I bought an Arduino Micro and tried it as you said. It worked like a charm, the Shadow PC won't shut down automatically anymore. Thanks again for your help!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moves the mouse by 1 pixel and back if there is motion in the room. Prevents computer from logging you off due to afk inactivity if you are in the same room. Resumes the same default security protocol if no motion is detected.