Last active
March 29, 2018 23:34
-
-
Save chrowe/c44d4ca9ba5bd2df8f83 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
SET=35 | |
echo "$SET" > "./set.txt" | |
IN=`/data/opk-1-wire-cli/pull -p 041471b7f4ff -s f -r` | |
OUT=`/data/opk-1-wire-cli/pull -p 041471b95dff -s f -r` | |
#echo "IN = "$IN | |
#echo "OUT = "$OUT | |
if [ $IN -gt $OUT ] && [ $IN -gt $SET ]; then | |
sudo /data/check-switch/switch.py -p 17 -s on | |
echo "On" | |
else | |
sudo /data/check-switch/switch.py -p 17 -s off | |
echo "Off" | |
fi |
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
35 |
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
#!/usr/bin/python | |
import argparse | |
import RPi.GPIO as GPIO | |
GPIO.setwarnings(False) | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-p","--path", required=True, help="Specify which GPIO pin your LED is connected to",type=int) | |
parser.add_argument("-s","--state", required=True, help="on/off. Turn LED on or off.") | |
args = parser.parse_args() | |
GREEN_LED = args.path | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(GREEN_LED, GPIO.OUT) | |
if args.state == "on" or args.state == 1: | |
GPIO.output(GREEN_LED, True) | |
elif args.state == "off" or args.state == 0: | |
GPIO.output(GREEN_LED, False) | |
else: | |
print ("Something went wrong") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment