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
370
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.4k
The future of (javascript) modules (in node)
ceejbot
1
220
Keeping JavaScript safe
ceejbot
3
380
ceej's how to solve it
ceejbot
6
740
work-life balance at npm
ceejbot
5
760
hash functions and you!
ceejbot
2
340
The accidental noder
ceejbot
2
130
Design Patterns & Modularity in the npm Registry
ceejbot
3
170
Monitoring on a budget
ceejbot
2
270
Other Decks in Programming
See All in Programming
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
120
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
260
今、知っておきたい! 生成AIエージェントの世界
elith
3
350
GitHub Copilotのススメ
marcy731
1
200
Git Rebase
bkuhlmann
11
1.6k
使ってみよう Azure AI Document Intelligence
kosmosebi
2
300
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
250
Elm Form Validation
bkuhlmann
0
510
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
380
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
200
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
The Invisible Customer
myddelton
114
12k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
Testing 201, or: Great Expectations
jmmastey
28
6.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
9
8.3k
How to name files
jennybc
65
93k
Designing Experiences People Love
moore
136
23k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
We Have a Design System, Now What?
morganepeng
43
6.7k
The Art of Programming - Codeland 2020
erikaheidi
42
12k
Creatively Recalculating Your Daily Design Routine
revolveconf
210
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
260
12k
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!