-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.coffee
58 lines (48 loc) · 1.06 KB
/
test.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Kryten = require './index.coffee'
kryten = new Kryten({repl: false})
#BLESerialPort = require('ble-serial').SerialPort;
#Firmata = require('firmata').Board;
#kryten = new Kryten({
# io: new Firmata(new BLESerialPort({}))
#})
testOptions =
'autoDetect': true
'port': ''
'interval': '500'
'components': [
{
'name': 'Led_Pin_13'
'action': 'digitalWrite'
'pin': '13'
}
{
'name': 'some_sensor'
'action': 'analogRead'
'pin': '3'
}
{
'name': 'Servo1'
'action': 'servo'
'pin': '6'
}
]
console.log kryten
kryten.configure(testOptions)
# You can do it this way too bc its funny if you get it
#kryten.spareHead(testOptions)
kryten.on 'ready', ->
console.log 'ready to go dog'
kryten.on 'data', (data)->
console.log data
# kryten.on 'angular-schema-form', (schema)->
# console.log schema
kryten.on 'config', (schema)->
console.log 'New Schema', schema
state = '1'
setInterval ->
kryten.onMessage({component: 'Led_Pin_13', state: state})
if state == '1'
state = '0'
else
state = '1'
,1000