Skip to content

Instantly share code, notes, and snippets.

@rococodogs
Last active March 27, 2017 19:11
Show Gist options
  • Save rococodogs/a3b4990f5d86f15a2a37b4a740bf6ad0 to your computer and use it in GitHub Desktop.
Save rococodogs/a3b4990f5d86f15a2a37b4a740bf6ad0 to your computer and use it in GitHub Desktop.
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
})
})
})
{
"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