Document intval lib
This commit is contained in:
parent
0fc4200f6d
commit
332399cfd7
|
@ -8,6 +8,9 @@ Class representing the intval3 features
|
|||
* [Intval](#Intval)
|
||||
* [._declarePins()](#Intval+_declarePins)
|
||||
* [._undeclarePins()](#Intval+_undeclarePins)
|
||||
* [._startFwd()](#Intval+_startFwd)
|
||||
* [._startBwd()](#Intval+_startBwd)
|
||||
* [._stop()](#Intval+_stop)
|
||||
* [.frame(dir, time, delay)](#Intval+frame)
|
||||
|
||||
<a name="Intval+_declarePins"></a>
|
||||
|
@ -24,6 +27,27 @@ Intval._undeclarePins() -
|
|||
(internal function) Undeclares all Gpio in event of uncaught error
|
||||
that interupts the node process
|
||||
|
||||
**Kind**: instance method of [<code>Intval</code>](#Intval)
|
||||
<a name="Intval+_startFwd"></a>
|
||||
|
||||
### intval._startFwd()
|
||||
Intval._startFwd() -
|
||||
Start motor in forward direction by setting correct pins in h-bridge
|
||||
|
||||
**Kind**: instance method of [<code>Intval</code>](#Intval)
|
||||
<a name="Intval+_startBwd"></a>
|
||||
|
||||
### intval._startBwd()
|
||||
Intval._startBwd() -
|
||||
Start motor in backward direction by setting correct pins in h-bridge
|
||||
|
||||
**Kind**: instance method of [<code>Intval</code>](#Intval)
|
||||
<a name="Intval+_stop"></a>
|
||||
|
||||
### intval._stop()
|
||||
Intval._stop() -
|
||||
Stop motor by setting both motor pins to 0 (LOW)
|
||||
|
||||
**Kind**: instance method of [<code>Intval</code>](#Intval)
|
||||
<a name="Intval+frame"></a>
|
||||
|
||||
|
|
|
@ -79,15 +79,41 @@ class Intval {
|
|||
this._pin.micro.unexport()
|
||||
this._pin.release.unexport()
|
||||
}
|
||||
/**
|
||||
* Intval._startFwd() -
|
||||
* Start motor in forward direction by setting correct pins in h-bridge
|
||||
*
|
||||
*/
|
||||
_startFwd () {
|
||||
this._pin.fwd.set(1)
|
||||
this._pin.bwd.set(0)
|
||||
//start high-cpu watch
|
||||
}
|
||||
/**
|
||||
* Intval._startBwd() -
|
||||
* Start motor in backward direction by setting correct pins in h-bridge
|
||||
*
|
||||
*/
|
||||
_startBwd () {
|
||||
this._pin.fwd.set(0)
|
||||
this._pin.bwd.set(1)
|
||||
}
|
||||
/**
|
||||
* Intval._stop() -
|
||||
* Stop motor by setting both motor pins to 0 (LOW)
|
||||
*
|
||||
*/
|
||||
_stop () {
|
||||
this._pin.fwd.set(0)
|
||||
this._pin.bwd.set(0)
|
||||
|
||||
let len = (+new Date()) - this._state.frame.start
|
||||
|
||||
console.log(`Frame stopped ${len}ms`)
|
||||
|
||||
this._pin.micro.unwatch()
|
||||
this._state.frame.active = false
|
||||
}
|
||||
_watchMicro (err, val) {
|
||||
/* Microswitch + 10K ohm resistor */
|
||||
/* 1 = open */
|
||||
|
@ -186,17 +212,6 @@ class Intval {
|
|||
sequence () {
|
||||
console.log(`Started sequence`)
|
||||
}
|
||||
_stop () {
|
||||
this._pin.fwd.set(0)
|
||||
this._pin.bwd.set(0)
|
||||
|
||||
let len = (+new Date()) - this._state.frame.start
|
||||
|
||||
console.log(`Frame stopped ${len}ms`)
|
||||
|
||||
this._pin.micro.unwatch()
|
||||
this._state.frame.active = false
|
||||
}
|
||||
status () {
|
||||
return this._state
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue