Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Saturday Morning BreakfastSerial: Hacking Arduinos in Python (Swift)
PyCon Canada
August 14, 2013
Education
2
110
Saturday Morning BreakfastSerial: Hacking Arduinos in Python (Swift)
PyCon Canada
August 14, 2013
Tweet
Share
More Decks by PyCon Canada
See All by PyCon Canada
Job Security (in Python) (Christopher Neugebauer)
pyconca
2
480
Sad Panda Needs a Hug (Nina Zakharenko)
pyconca
0
350
Shopify Checkout (Chris Saunders)
pyconca
0
170
Skyfield and 15 Years of Bad APIs (Brandon Rhodes)
pyconca
0
270
Planting Open Source Seeds (Kenneth Reitz)
pyconca
0
80
Why Open Source Works (Alex Gaynor)
pyconca
0
110
How to learn Python in 5 Minutes (Daniel Moniz)
pyconca
0
960
Sunday Morning Keynote (Karen Brennan)
pyconca
0
180
Saturday Morning Keynote (Jacob Kaplan-Moss)
pyconca
2
85
Other Decks in Education
See All in Education
鹿児島大学 法文学部 講義「キャリア論」
yoshikouki
0
870
Web 2.0 Patterns and Technologies - Lecture 8 - Web Technologies (1019888BNR)
signer
PRO
0
1.3k
AWS認定、オンラインで受けるか?オフラインで受けるか?
amarelo_n24
0
150
1123
cbtlibrary
0
340
Statistical Rethinking 2023 - Lecture 02
rmcelreath
1
760
子どものためのプログラミング道場『CoderDojo』〜法人提携例〜 / Partnership with CoderDojo Japan
coderdojojapan
5
8.5k
プログラミング単元の授業のポイント 進め方とクラウド型実習環境の活用
asial_edu
0
180
Virtuaalilasit ja 360-sisällöt opetuksessa
matleenalaakso
0
3.3k
共テ前日からでも間に合う確率分布
cp20
0
280
Classi_会社紹介資料
classijp
8
46k
Statistical Rethinking 2023 - Lecture 03
rmcelreath
1
450
FBCのご紹介
komagata
0
120
Featured
See All Featured
What the flash - Photography Introduction
edds
64
10k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
Scaling GitHub
holman
453
140k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
500
130k
Fireside Chat
paigeccino
16
1.8k
GraphQLとの向き合い方2022年版
quramy
20
9.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
31
1.8k
YesSQL, Process and Tooling at Scale
rocio
159
12k
For a Future-Friendly Web
brad_frost
166
7.7k
How to Ace a Technical Interview
jacobian
270
21k
Build The Right Thing And Hit Your Dates
maggiecrowley
22
1.4k
Making the Leap to Tech Lead
cromwellryan
116
7.6k
Transcript
BREAKFAST SATURDAY MORNING SERIAL by @SwiftAlphaOne
Note: I’m not Ryan Gosling @SwiftAlphaOne
ARDUINO! Let’s talk about
Why are developers cuckoo for arduino?
SIMPLE API
Giraffe Add Tiger Head Tigeraffe Arduino is Open Source
None
EVERYWHERE Now Available
LOTS OF EXAMPLES
GR-R-REAT! Arduino is
1 2 3 4 USB Serial Port Ground & Power
Digital Pins Analog Pins ARDUINO 101
HELLO WORLD “ ”
Download the IDE http://arduino.cc/en/main/software
Wire up a LED
Blink 1: Arduino int led = 13; void setup() {
pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); delay(1000); }
Prototyping in C, Hey kids! is totally fun and easy.
“ ” - The Trix Rabbit
Friends don’t let Friends PROGRAM IN C.
THE INTERNETS? How do I talk to “ ”
#include <Ethernet.h> #include <SPI.h> EthernetClient client; String data = '{"foo":"bar"}';
void setup() { Ethernet.begin({0x90,0xA2,0xDA,0x00,0x55,0x8D}); } void loop() { if (client.connect("www.someapi.com",80)) { client.println("POST /api/v1/endpoints HTTP/1.1"); client.println("Host: www.someapi.com"); client.println("Content-Type: application/json"); client.print("Content-Length: "); client.println(data.length()); client.println(); client.print(data); client.println(); } }
#include <Ethernet.h> #include <SPI.h> EthernetClient client; String data = '{"foo":"bar"}';
void setup() { Ethernet.begin({0x90,0xA2,0xDA,0x00,0x55,0x8D}); } void loop() { if (client.connect("www.someapi.com",80)) { client.println("POST /api/v1/endpoints HTTP/1.1"); client.println("Host: www.someapi.com"); client.println("Content-Type: application/json"); client.print("Content-Length: "); client.println(data.length()); client.println(); client.print(data); client.println(); } } LOL
HORSEPOWER Limited .
A BETTER WAY! There must be
Feature Wishlist Language Agnostic Cross Platform Talks to the Internets
Complex Processing
FIRMATA http://firmata.org Follow your nose!
from pyfirmata import Arduino from time import sleep board =
Arduino('/dev/cu.usbmodem1411') ledPin = board.board.digital[13] while 1: ledPin.write(1) sleep(1) ledPin.write(0) sleep(1) Blink 2: pyFirmata
Johnny-Five ? Javascript Ruby Python
Cookies for breakfast!? Python ^
BREAKFASTSERIAL http://github.com/theycallmeswift/BreakfastSerial
$ pip install BreakfastSerial
from BreakfastSerial import Arduino, Led board = Arduino() led =
Led(board, 13) led.blink(1000) Blink 3: BreakfastSerial
None
Feature Wishlist Language Agnostic Cross Platform Talks to the Internets
Complex Processing
Language Agnostic Cross Platform Talks to the
Internets Complex Processing Feature Wishlist
Buttons, LEDs, & Sensors. “ ” Servos & buzzers too.
Lots of new components, added by devs like you!
SRSLY THO, I ACCEPT PULLS http://github.com/theycallmeswift/BreakfastSerial
M OAR!
ARDUINO.IO No, really. It’s coming. Go sign up. http://arduino.io
THANK YOU @SwiftAlphaOne theycallmeswift.com