LoginSignup
8
9

More than 5 years have passed since last update.

TesselをMacにつないでLEDを点滅させるまで

Last updated at Posted at 2014-10-18

参考(というかそのまんま): http://start.tessel.io/install

node.jsとnpmの資産にまるごと乗っかってるし、REPLもあるし、Wifi経由で簡単にインターネット接続デバイスになるし、これもしかしてめっちゃ良いものなのでは?

環境構築

  • node.jsをHomebrewでインストール
    • Macなのでbrew install node
  • Tessel開発ツールをnpmでインストール
    • npm install -g tessel
  • TesselとMacをUSBケーブルをつなぐ
    • PowerのLEDが緑色に点灯
  • Tesselのファームウェアをアップデート
    • tessel updateでしばらく色々表示され成功した模様。
$ tessel update
...
INFO Downloading remote file https://builds.tessel.io/firmware/tessel-firmware-current.bin
INFO Updating firmware... please wait. Tessel will reset itself after the update
INFO Complete  1365416 /1365416

$ tessel wifi -n [network name] -p [password]
TESSEL! Connected to TM-00-04-f0009a30-005e4f56-5cba6249.
INFO Connecting to "network name" with wpa2 security...
INFO Acquiring IP address. 
....
INFO Connected!

IP       192.168.2.111
DNS      8.8.8.8
DHCP     192.168.2.1
Gateway  192.168.2.1

npmプロジェクトから

  • 最初のtesselプロジェクトを作成
    • mkdir tessel-code && cd tessel-code && npm init
    • ってか普通のnode.jsプロジェクトですね
  • http://start.tessel.io/blinky からコピペしたblink.jsを走らせる
    • tessel run blink.jsするとサクッとLEDが点滅。簡単
$ tessel run blink.js 
TESSEL! Connected to TM-00-04-f0009a30-005e4f56-5cba6249.
INFO Bundling directory /Users/hogelog/repos/hogelog/js/tessel-code
INFO Deploying bundle (5.50 KB)...
INFO Running script...
I'm blinking! (Press CTRL + C to stop)
I'm blinking! (Press CTRL + C to stop)
...

npmモジュール追加したらそのまんま動くっぽいしめっちゃ便利そう。npm install -g tesselでインストールした開発ツール自体もnode.js、npmの仕組み上に乗っかったオープンソースなツールっぽい。
https://github.com/tessel/cli

REPLから

REPL(Read-Eval-Print-Loop、対話的実行環境)があった。めっちゃべんり。

$ tessel repl
TESSEL! Connected to TM-00-04-f0009a30-005e4f56-5cba6249.
INFO Bundling directory /usr/local/lib/node_modules/tessel/scripts/repl
INFO Deploying bundle (6.50 KB)...
INFO Running script...
> var tessel = require("tessel");
...
> tessel.led[0].toggle()
undefined
> tessel.led[0].toggle()
undefined

感想

良い。インターネットなアレコレと接続してもうちょっと色々遊んでみよう。

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9