doorlock/src/models/door.js

23 lines
448 B
JavaScript
Raw Normal View History

2018-08-12 13:52:15 -07:00
const { Board } = require('easy-usb-relay')
const DELAY = 6000
2018-07-10 14:47:07 -07:00
module.exports = class Door {
static open() {
2018-08-12 13:52:15 -07:00
return new Promise(success => {
console.log('OPEN DOOR!')
const board = new Board(2)
setTimeout(() => {
console.log('CLOSING DOOR!')
board.allOff()
success()
}, DELAY)
return board.allOn()
2018-08-12 13:52:15 -07:00
})
2018-07-10 14:47:07 -07:00
}
// static close() {
// console.log('CLOSE DOOR!!!!!!!!!!!!')
// }
2018-07-10 14:47:07 -07:00
}