Skip to content

Instantly share code, notes, and snippets.

@companje
Created November 7, 2014 09:20
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 companje/f53735a1152fd3dd1635 to your computer and use it in GitHub Desktop.
Save companje/f53735a1152fd3dd1635 to your computer and use it in GitHub Desktop.
Script to 'press' power button on Shuttle PC SH61R4
//This code runs on MSP430 LaunchPad MSP-EXP430G2 and is compiled+uploaded with Energia
void setup() {
pinMode(P1_4,INPUT); //POWER BTN
// pinMode(P1_5,OUTPUT); //LED output
pinMode(P2_0,INPUT); //LED input
pinMode(P1_0,OUTPUT); //feedback LED1
pinMode(P1_6,OUTPUT); //feedback LED2, represents state of P2_0
digitalWrite(P1_0,HIGH); //turn on RED led indicating no action
digitalWrite(P1_6,digitalRead(P2_0)); //forward LED status using GREEN led
delay(5000);
if (!digitalRead(P2_0)) {
pinMode(P1_4,OUTPUT);
digitalWrite(P1_4,LOW);
delay(100);
pinMode(P1_4,INPUT); //POWER BTN
digitalWrite(P1_0,LOW); //turn off RED led indicating power action performed
}
}
void loop() {
digitalWrite(P1_6,digitalRead(P2_0)); //forward LED status using GREEN led
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment