npm install
Last active
March 27, 2017 19:11
-
-
Save rococodogs/a3b4990f5d86f15a2a37b4a740bf6ad0 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
const Raspi = require('raspi-io') | |
const five = require('johnny-five') | |
const board = new five.Board({ | |
repl: false, | |
io: new Raspi(), | |
}) | |
const SlackClient = require('@slack/client').WebClient | |
const Slack = new SlackClient('<slack client token>') | |
board.on('ready', function () { | |
console.log('board is ready omg') | |
const button = new five.Button('GPIO17') | |
button.on('press', function () { | |
Slack.chat.postMessage('<board id>', 'HALLO', function (err) { | |
if (err) throw err | |
}) | |
}) | |
}) |
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
{ | |
"name": "button-caller", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "MIT", | |
"dependencies": { | |
"@slack/client": "^3.9.0", | |
"johnny-five": "^0.10.6", | |
"raspi-io": "^7.2.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment