UNPKG

@frezik/rpi-doorbot-ts

Version:

Modules to interface doorbot-ts to the Raspberry Pi

34 lines (23 loc) 772 B
import * as tap from 'tap'; import * as Doorbot from '@frezik/doorbot-ts'; import * as RPi from '../index'; import * as os from 'os'; const PIN = 27; Doorbot.init_logger( os.tmpdir() + "/doorbot_test.log" ) tap.plan( 2 ); const always = new Doorbot.AlwaysAuthenticator(); const act = new Doorbot.DoNothingActivator( () => { tap.pass( "Callback made" ); process.exit(); }); tap.comment( "Once first test has hit, connect pin " + PIN + " to a 5V pin" ); const gpio_reader = new RPi.GPIOReader( PIN ); tap.ok( gpio_reader instanceof Doorbot.Reader, "gpio reader is a Reader" ); gpio_reader.init().then( () => { gpio_reader.setAuthenticator( always ); always.setActivator( act ); gpio_reader .run() .then( (res) => {} ); });