Skip to content

Instantly share code, notes, and snippets.

@technobly
Created February 24, 2019 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technobly/41754d4ec0741fbb7e1ac6b9b5747f58 to your computer and use it in GitHub Desktop.
Save technobly/41754d4ec0741fbb7e1ac6b9b5747f58 to your computer and use it in GitHub Desktop.
Steam Machine Kill Switch (Simple Version)
/**
* 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