Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jake Read
rndmc
Commits
fc639ed1
Commit
fc639ed1
authored
Nov 02, 2018
by
Jake Read
Browse files
probably just about to break everything
parent
db873c86
Changes
2
Hide whitespace changes
Inline
Side-by-side
server.js
View file @
fc639ed1
...
...
@@ -239,6 +239,7 @@ t6.outputs.packet.attach(bridge.inputs.F)
bridge.outputs.F.attach(t6.inputs.packet)
//bridge.state.rF = '0'
*/
t7
.
outputs
.
packet
.
attach
(
bridge
.
inputs
.
G
)
bridge
.
outputs
.
G
.
attach
(
t7
.
inputs
.
packet
)
...
...
src/hardware/atkbbb.js
0 → 100644
View file @
fc639ed1
// boilerplate atkapi header
const
InOut
=
require
(
'
../../lib/inout.js
'
)
let
Input
=
InOut
.
Input
let
Output
=
InOut
.
Output
let
State
=
InOut
.
State
let
Button
=
InOut
.
Button
const
PCKT
=
require
(
'
../../lib/packets.js
'
)
// a constructor, a fn, a javascript mess
function
ATKBreadBoardServo
(
port
)
{
var
atkbbs
=
{
// descriptions are used in UI
description
:
{
name
:
'
Breadboard Servo Signal Generator
'
,
alt
:
'
servo
'
,
isHardware
:
true
}
}
atkbbs
.
state
=
State
()
// alias !
var
state
=
atkbbs
.
state
state
.
button
=
Button
(
'
SEND
'
)
state
.
onChange
(
'
button
'
,
onButtonPress
)
state
.
servoVal
=
0
// 0->100 does 1 -> 2ms duty on 20ms period
state
.
onChange
(
'
servoVal
'
,
onButtonPress
)
atkbbs
.
inputs
=
{
packet
:
Input
(
'
headless packet
'
,
onPacketReturn
)
// makes anything into '1' event
}
atkbbs
.
outputs
=
{
packet
:
Output
(
'
number
'
)
}
function
onButtonPress
(
evt
)
{
var
pwm
=
state
.
servoVal
if
(
pwm
>
100
){
pwm
=
100
}
else
if
(
pwm
<
0
){
pwm
=
0
}
var
microval
=
Math
.
round
(
7.5
*
pwm
)
console
.
log
(
'
pwm on line
'
,
microval
)
var
pwmpack
=
PCKT
.
pack32
(
microval
)
pwmpack
.
unshift
(
141
)
atkbbs
.
outputs
.
packet
.
emit
(
pwmpack
)
}
function
onPacketReturn
(
evt
)
{
}
return
atkbbs
}
// exports
module
.
exports
=
ATKBreadBoardServo
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment