Created
February 24, 2019 23:42
-
-
Save technobly/41754d4ec0741fbb7e1ac6b9b5747f58 to your computer and use it in GitHub Desktop.
Steam Machine Kill Switch (Simple Version)
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
/** | |
* Steam Machine Kill Switch (Simple Version) | |
* Brett Walach | |
* 2019-02-24 | |
* | |
* A0 is wired directly to the gate of a 2N7002 mosfet | |
* The source of the 2N7002 is connected to GND | |
* The drain of the 2N7002 is connected to the Steam Machine's power switch | |
* Computer GND is connected the Xenon's GND | |
* Computer +5V from a USB port is connected to the Xenon's Li+ | |
*/ | |
#include "Particle.h" | |
bool isPowerOff = false; | |
int powerOff(String cmd) { | |
isPowerOff = true; | |
return 0; | |
} | |
void setup() { | |
pinMode(A0, OUTPUT); | |
Particle.function("poweroff", powerOff); | |
} | |
void loop() { | |
if (isPowerOff) { | |
digitalWriteFast(A0, HIGH); | |
delay(500); | |
digitalWriteFast(A0, LOW); | |
isPowerOff = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment