Push dev work to master #2
|
@ -2,13 +2,29 @@
|
||||||
|
|
||||||
const Gpio = require('onoff').Gpio
|
const Gpio = require('onoff').Gpio
|
||||||
|
|
||||||
|
let release
|
||||||
|
let micro
|
||||||
|
let fwd
|
||||||
|
let bwd
|
||||||
|
|
||||||
|
process.on('SIGINT', () => {
|
||||||
|
if (fwd && fwd.writeSync) {
|
||||||
|
console.log(`Setting fwd to 0`)
|
||||||
|
fwd.writeSync(0)
|
||||||
|
}
|
||||||
|
if (bwd && bwd.writeSync) {
|
||||||
|
console.log(`Setting bwd to 0`)
|
||||||
|
bwd.writeSync(0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function releaseTest () {
|
function releaseTest () {
|
||||||
const PIN = 5
|
const PIN = 6
|
||||||
const btn = Gpio(PIN, 'in', 'both')
|
release = Gpio(PIN, 'in', 'both')
|
||||||
console.log(`Watching input on GPIO 0${PIN}`)
|
console.log(`Watching input on GPIO 0${PIN}`)
|
||||||
let saveTime = 0
|
let saveTime = 0
|
||||||
let active = false
|
let active = false
|
||||||
btn.watch((err, val) => {
|
release.watch((err, val) => {
|
||||||
const NOW = +new Date()
|
const NOW = +new Date()
|
||||||
/* Button + 10K ohm resistor */
|
/* Button + 10K ohm resistor */
|
||||||
/* 1 = open */
|
/* 1 = open */
|
||||||
|
@ -48,13 +64,13 @@ function releaseTest () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function microTest () {
|
function microTest () {
|
||||||
const PIN = 6
|
const PIN = 5
|
||||||
const btn = Gpio(PIN, 'in', 'both')
|
micro = Gpio(PIN, 'in', 'both')
|
||||||
console.log(`Watching input on GPIO 0${PIN}`)
|
console.log(`Watching input on GPIO 0${PIN}`)
|
||||||
let saveTime = 0
|
let saveTime = 0
|
||||||
let frameActive = true //this._state.frame.active
|
let frameActive = true //this._state.frame.active
|
||||||
let primed = false //this._state.primed
|
let primed = false //this._state.primed
|
||||||
btn.watch((err, val) => {
|
micro.watch((err, val) => {
|
||||||
const NOW = +new Date()
|
const NOW = +new Date()
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.error(err)
|
return console.error(err)
|
||||||
|
@ -83,17 +99,18 @@ function microTest () {
|
||||||
}
|
}
|
||||||
|
|
||||||
//test stepping up of 3.3V RPI logic via
|
//test stepping up of 3.3V RPI logic via
|
||||||
//Sparkfun PRT-10967 (NPC1402)
|
//Sparkfun PRT-10968 (NPC1402)
|
||||||
function stepupTest () {
|
function stepupTest () {
|
||||||
const FWD = 13 // RPIO PIN 13
|
const FWD = 13 // RPIO PIN 13
|
||||||
const BWD = 19
|
const BWD = 19
|
||||||
const fwd = Gpio(FWD, 'out')
|
fwd = Gpio(FWD, 'out')
|
||||||
const bwd = Gpio(BWD, 'out')
|
bwd = Gpio(BWD, 'out')
|
||||||
|
|
||||||
console.log(`Setting pin ${FWD} high`)
|
console.log(`Setting pin ${FWD} high`)
|
||||||
fwd.writeSync(1)
|
fwd.writeSync(1)
|
||||||
|
bwd.writeSync(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
releaseTest()
|
releaseTest()
|
||||||
microTest()
|
microTest()
|
||||||
stepupTest()
|
stepupTest()
|
||||||
|
|
Loading…
Reference in New Issue