forked from Reactive-Extensions/RxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblinky.js
More file actions
25 lines (20 loc) · 665 Bytes
/
Copy pathblinky.js
File metadata and controls
25 lines (20 loc) · 665 Bytes
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
// Run with "tessel run blinky.js"
// Import the interface to Tessel hardware
var tessel = require('tessel');
// Must use lite compat due to https://github.com/tessel/runtime/issues/658
var Observable = require('../../dist/rx.lite.compat').Observable;
// Set the led pins as outputs with initial states
// Truthy initial state sets the pin high
// Falsy sets it low.
var led1 = tessel.led[0].output(1);
var led2 = tessel.led[1].output(0);
Observable.interval(100)
.subscribe(function () {
console.log('first blinks');
led1.toggle();
});
Observable.interval(150)
.subscribe(function () {
console.log('second blinks');
led2.toggle();
});