-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpiconServer.js
More file actions
executable file
·37 lines (35 loc) · 913 Bytes
/
piconServer.js
File metadata and controls
executable file
·37 lines (35 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Meteor.startup(function(){
Meteor.call('piconInit');
});
Meteor.publish("sensehat",function(){
return Sensehat.find({});
});
Meteor.methods({
'piconInit' : function(){
// run on startup ...
RunCli.run('chmod -R 755 assets/app/');
Meteor.call('clear_pixel');
return true;
},
'set_pixel' : function(x,y,r,g,b){
RunCli.run('./assets/app/set_pixel.py ' + x + ' ' + y + ' '+ r + ' ' + g + ' ' + b);
return true;
},
'clear_pixel' : function(r,g,b){
if(typeof r != "undefined" && typeof g != "undefined" && typeof b != "undefined"){
RunCli.run('./assets/app/clear_pixel.py ' + r + ' ' + b + ' ' + g);
}else{
RunCli.run('./assets/app/clear_pixel.py');
}
return true;
},
'load_grid' : function(gridId){
if(typeof gridId != "undefined"){
if(Sensehat.findOne(gridId)){
RunCli.run('./assets/app/loadGrid.py ' + gridId);
return true;
}
}
return false;
}
});