Created
November 7, 2014 09:20
-
-
Save companje/f53735a1152fd3dd1635 to your computer and use it in GitHub Desktop.
Script to 'press' power button on Shuttle PC SH61R4
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
//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