Skip to content

Commit

Permalink
move buton to pin 16
Browse files Browse the repository at this point in the history
  • Loading branch information
saoron committed Nov 30, 2017
1 parent 2b6f567 commit 5b807a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions daemons/bluetooth/characteristic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ var bleno = require('bleno');

var BlenoCharacteristic = bleno.Characteristic;

var exec = require('child_process').exec;


var gpio = require('rpi-gpio');
gpio.setup(29, gpio.DIR_IN, gpio.EDGE_BOTH);
gpio.setup(16, gpio.DIR_IN, gpio.EDGE_BOTH);

var ex = null;

Expand All @@ -36,6 +33,7 @@ buttonStream.prototype.onReadRequest = function (offset, callback) {

buttonStream.prototype.onSubscribe = function (maxValueSize, updateValueCallback) {
ex = updateValueCallback
spawn('python',["/home/Cardigan/modules/indicators/python/states/standalone.py", "isPaired"]);
}

gpio.on('change', function (channel, value) {
Expand All @@ -52,7 +50,7 @@ gpio.on('change', function (channel, value) {

// push videoId to app
if (ex){
var process = spawn('python',["/home/Cardigan/modules/indicators/python/states/standalone.py", "buttonPress"]);
spawn('python',["/home/Cardigan/modules/indicators/python/states/standalone.py", "buttonPress"]);

var data = new Buffer(Buffer.byteLength(currentTimeStamp, 'utf8') + 2);

Expand All @@ -61,7 +59,7 @@ gpio.on('change', function (channel, value) {
console.log('NotifyOnlyCharacteristic update value: ' + currentTimeStamp);
ex(data);
}else{
var process = spawn('python',["/home/Cardigan/modules/indicators/python/states/standalone.py", "buttonPressOffline"]);
spawn('python',["/home/Cardigan/modules/indicators/python/states/standalone.py", "buttonPressOffline"]);
}

}
Expand Down
2 changes: 1 addition & 1 deletion dride-ws

0 comments on commit 5b807a7

Please sign in to comment.