Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Where does the javascript run, anyway?
Search
C J Silverio
November 15, 2013
Programming
4
380
Where does the javascript run, anyway?
A beginner's guide to hardware with Javascript.
C J Silverio
November 15, 2013
Tweet
Share
More Decks by C J Silverio
See All by C J Silverio
The economics of package management
ceejbot
4
1.5k
The future of (javascript) modules (in node)
ceejbot
1
270
Keeping JavaScript safe
ceejbot
3
400
ceej's how to solve it
ceejbot
6
760
work-life balance at npm
ceejbot
5
780
hash functions and you!
ceejbot
2
340
The accidental noder
ceejbot
2
140
Design Patterns & Modularity in the npm Registry
ceejbot
3
180
Monitoring on a budget
ceejbot
2
280
Other Decks in Programming
See All in Programming
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.8k
RubyLSPのマルチバイト文字対応
notfounds
0
120
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Click-free releases & the making of a CLI app
oheyadam
2
120
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.3k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
CSC509 Lecture 13
javiergs
PRO
0
110
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Automating Front-end Workflow
addyosmani
1366
200k
Building an army of robots
kneath
302
43k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Unsuck your backbone
ammeep
668
57k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Being A Developer After 40
akosma
87
590k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Transcript
Where does the javascript run, anyway? A beginner’s guide to
js + hardware C J Silverio @ceejbot
Tab Hunter easily located?
I never tracked the cat.
Then I went to a hack day.
None
That’s a cat about to be tracked.
Text Let’s talk microcontrollers. Arduino, Raspberry Pi, Beaglebone, and beyond.
Hardware input & output What the Arduino & the Pi
have in common: inputs and outputs.
Connect to the physical world. Turn lights on & off.
Run motors. Fire missiles at nodecopters. !
General-purpose I/O aka the GPIO or the “pin”
The super power of a microcontroller is the GPIO. The
GPIO connects variables in software to physical objects: the power level on a wire is information.
Breadboard 101 The + and – columns are connected. The
rows are connected. Board +/5V ➜ + Board ground ➜ –
Lighting an LED is simple. Power to breadboard resistor from
+ to long wire on the LED LED short wire to breadboard – – to board GND
Software! Decision-making! Now we make the microcontroller do some work.
Text Arduino Easy to start with! Lots of GPIO pins.
Text Button: a typical circuit power, ground, control signal software
on the Arduino to read its state
We’re about to get the javascript into it.
Johnny-Five to the rescue StandardFirmata sketch ➜ Arduino npm install
johnny- five write javascript
Async Goodness with Buttons ! var five = require('johnny-five'); var
board = new five.Board(); ! board.on('ready', function() { // signal goes into arduino pin 8 var button = new five.Button(8); ! button.on('down', function() { console.log('down'); }); button.on('up', function() { console.log('up'); }); button.on('hold', function() { console.log('holding'); }); });
Tethered. :( You need to stay connected to a host
capable of running Node.js, which the Arduino is not.
Upgrade the microcontroller! Let’s move from the early 80s to
the late 90s.
None
You run Linux on these. OMG.
Decisions, decisions. Arduino tiny Arduinos Raspberry Pi Beagle cheap cheaper
CPU! more CPU! 14 pins size varies 8 pins 65 pins lots of modules features vary great video more memory C++ js tethered C++ any language any language prototyping mobile projects general use, audio-vis CPU-intensive lots of connections
Text Cat Tracker uses 2 boards Teensy on the cat,
Beaglebone at the cat door
Next gen Tessel Espruino Javascript as first-class language
Next steps! Go to a hack day! http://nodebots.io Run a
hack day!
http://node-ardx.org The Arduino experimenter’s guide for Javascript
Practical Electronics for Inventors Paul Scherz & Simon Monk
Play! Putter around. Buy two of everything because you will
melt things sometimes. It’ll be okay.
Learn strange new things. USB? Bluetooth? Serial? Radios? Reverse-engineer something!
Go forth & build!