Skip to content

Commit

Permalink
added python script folder
Browse files Browse the repository at this point in the history
  • Loading branch information
krpeacock committed Jan 27, 2017
1 parent 0d0056f commit 9bc0a98
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.js
Expand Up @@ -60,10 +60,10 @@ function Switch(switchValues){

// needed due to a quirk with PythonShell
function onString(number){
return './public/python/scripts/sw' + number + '_on.py'
return './public/python/sw' + number + '_on.py'
}
function offString(number){
return './public/python/scripts/sw' + number + '_off.py'
return './public/python/sw' + number + '_off.py'
}


Expand Down Expand Up @@ -105,7 +105,7 @@ app.get('/api/switches/:id', function(req, res){
})

app.post('/api/switches/:id', function(req, res){

// For now, uses a simple password query in the url string.
// Example: POST to localhost:8000/API/switches/sw1?password=test
if (req.query.password === process.env.PASS){
Expand Down
7 changes: 7 additions & 0 deletions public/python/sw1_off.py
@@ -0,0 +1,7 @@
# Edit line 6 to match your chosen GPIO pin

import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
GPIO.cleanup()
6 changes: 6 additions & 0 deletions public/python/sw1_on.py
@@ -0,0 +1,6 @@
# Edit line 6 to match your chosen GPIO pin

import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.OUT)

0 comments on commit 9bc0a98

Please sign in to comment.