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
Controlling Arduino With PHP
Search
Thomas Weinert
October 03, 2015
Programming
2
510
Controlling Arduino With PHP
PHPNW2015 Unconference
https://joind.in/talk/view/15483
Thomas Weinert
October 03, 2015
Tweet
Share
More Decks by Thomas Weinert
See All by Thomas Weinert
Build Automation with Phive and Phing
thomasweinert
0
160
Introduction: PHP Extensions
thomasweinert
2
770
PCRE - Matching Patterns
thomasweinert
0
100
PCRE With PHP
thomasweinert
0
620
Modern PHP
thomasweinert
3
210
Controlling Arduino With PHP
thomasweinert
1
130
XPATH WITH PHP AND JS
thomasweinert
0
88
PHPUG CGN: Arduino With PHP
thomasweinert
0
110
IPC 2013: Controlling Arduino With PHP
thomasweinert
0
190
Other Decks in Programming
See All in Programming
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
4
950
受け取る人から提供する人になるということ
little_rubyist
0
180
Amazon Qを使ってIaCを触ろう!
maruto
0
370
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1.1k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.2k
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
330
C++でシェーダを書く
fadis
6
3.9k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
410
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
420
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
4.2k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
310
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
334
57k
Producing Creativity
orderedlist
PRO
341
39k
Facilitating Awesome Meetings
lara
49
6.1k
How to Ace a Technical Interview
jacobian
276
23k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Code Reviewing Like a Champion
maltzj
520
39k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.8k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
15
2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Transcript
CONTROLLING ARDUINO WITH PHP CONNECTIONS TO THE PHYSICAL WORLD @ThomasWeinert
ARDUINO Arduino is an open-source electronics prototyping platform based on
flexible, easy-to- use hardware and software. It's intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments.
ARDUINO UNO
ARDUINO MEGA
SHIELDS HTTP://SHIELDLIST.ORG/
NETWORK
PROTOTYPE
MOTOR
ARDUINO NANO
NANO ON BREADBOARD
NANO ON BASE
BREADBOARD
BREADBOARD HALFSIZE
BREADBOARD SCHEMA
BREADBOARD IN USE
BREADBOARD IN USE
FRITZING http://fritzing.org
$ $ % % & & ' ' ( ( ) ) * * + + , , - -
ARDUINO IDE
None
FIRMATA
FIRMATA PROTOCOL Midi Based Pin Status Pin Manipulation Extended Commands
FIRMATA TEST
FIRMATA TEST PHP
None
PHP - SERIAL PORTS + Just streams - Console commands
for configuration
WINDOWS - fread() blocks until it gets data.
SERPROXY
GORILLA PHPMAKE\SERIALPORT https://github.com/oasynnoum/phpmake_serialport
FIRST PROJECT
COMPOSER CREATE Ş ŵ ŞŞŞʰ
None
CONFIGURE BOOTSTRAP ŵƋƋ ƋŞ Ƌ Ş ſƀ Ƌŵ ſɐ ɏ ɏɐřɐɐƀŚ ſɐ
ɏ ɏ ɏ ɐřɐŵŵɥɐƀŚ ſɐ ɏ ɏ ɏɐřɬɮɭɥɥƀŚ ſɐ ɏ ɏɏɐřɐɨɩɮŜɥŜɥŜɨɐƀŚ ſɐ ɏ ɏɏɐřɬɪɪɰƀŚ
SKELETON ɛʰ ſɏɏ ɏɏŜɐŵŜɐƀŚ ɎŚ ɛ Şʴ ſƀ Şʴſ ſƀſɛƀƇ ŵŵŠ ƈ
ƀŚ Ɏ ɎɎɎ śśſƀŚ
LED OBJECT ɛʰ ſɏɏ ɏɏŜɐŵŜɐƀŚ ɎŚ ɛ Şʴ ſƀ Şʴſ ſƀſɛƀƇ ɛʰɎſɛŞʴƃɨɪƄƀŚ
ɛŞʴſɩɥɥɥƀŞʴſƀŚ ƈ ƀŚ Ɏ ɎɎɎ śśſƀŚ
,R (YHQW/RRS 6HUYHU )LUPDWD 3URWRFRO &KLS 'HYLFHV
BASIC BLINK ɛŞʴſɨɪřɥɥɨƀŚ ſƀƇ ɛŞʴſɨɪřɥ ƀŚ ſɨƀŚ ɛŞʴſɨɪřɥɥɥƀŚ ſɨƀŚ ƈ
BASIC BLINK OOP ɛŞʴƃɨɪƄŞʴʰ Ɏ ɎśśɏŚ ſƀƇ ɛŞʴƃɨɪƄŞʴʰŠɛŞʴƃɨɪƄŞʴŚ ſɨƀŚ ƈ
BLINK NONBLOCKING ɛʰ ɎɎɎ śśſƀŚ ɛ Şʴ ſƀ Şʴſ ſƀſɛřɛƀƇ ɛʰɛŞʴƃɨɪƄŚ
ɛŞʴʰ ɎśśɏŚ ɛŞʴ ſ ſƀſɛƀƇ ɛŞʴʰŠɛŞʴŚ ƈř ɨɥɥɥ ƀŚ ƈ ƀŚ ɛŞʴſƀŚ
CARICA CHIP ɛʰ ɎɎſɛŞʴƃɨɪƄƀŚ ɛŞʴſƀŞʴſƀŚ
CARICA CHIP ɛʰ ɎɎſɛŞʴƃɨɪƄƀŚ ɛŞʴſƀŞʴſƀŚ
CARICA CHIP ɛʰ ɎɎſɛŞʴƃɨɪƄƀŚ ɛŞʴſɥŜɬƀŞʴſƀŞʴſƀŚ
CARICA IO Event Loop Event Emitter Promises Device Interfaces
EVENT LOOP
JAVASCRIPT EXAMPLE ʰ Ŝ ſɐɐƀŚ ʰɥŚ ʰŜ ſ ſƀƇ ŜʰŜʫ ŜſƀʫɐřɐŚ ʫʫŚ
ƈř ɨɥɥɥ ƀŚ
PHP EXAMPLE ɛʰ Ɏ ɎɎɎ śśſƀŚ ɛŞʴ ſ ſƀƇ ɛʰɥŚ ɛʫʫŚ
ƈř ɨɥɥɥ ƀŚ ɛŞʴſƀŚ
PROMISES They describe an object that acts as a proxy
for a result that is initially unknown, usually because the computation of its value is yet incomplete.
JAVASCRIPT EXAMPLE ŜſɐŞŜɐƀ Ŝſ ſƀƇ ſɐŜɐƀŚ ƈ ƀ ƀŚ
PHP EXAMPLE ɛʰ Ɏ ɎɎſſɐ ɐƀƀŚ ɛʰ Ɏ ɎɎſſɐ ɐƀƀŚ ɛʰ ſƀŚ ɛʰ ſɛƀſɛƀƇ ɏſɏɏſɛƀƀŚ ɏſ ſƀŞɛƀŚ
ƈŚ ɛʰ Ɏ Ɏśśſ ɛſɑɐɨɐřſɬƀɑƀ Şʴſɛƀř ɛſɑɐɩɐřſɨƀɑƀ Şʴſɛƀ ƀŚ Ɏ ɎɎɎ śśſɛƀŚ
EVENT EMITTER ɛʰɎ ſɐ śŵŵŜɐƀŚ ɛŞʴſƀŞʴſ ɐŞɐř ſɛƀƇ ɛŚ ƈ ƀŚ
ɛŞʴſƀŞʴſ ɐɐř ſɛƀſɛƀƇ ɛŚ ɛŞʴſƀŚ ƈ ƀŚ
INTERACTION
HTTPSERVER Ɏ ɎɎ Ś ɛʰ ɎſƀŚ ɛŞʴ ſ ɐŵŵƇƈɐř ſ ɎɛřɛƀƇ
ɛʰɛŞʴ ſ ɎɎɎſ ɑ ɑŜɛƃɐɐƄŜɑŠɎɑ ƀ ƀŚ ɛŚ ƈ ƀŚ
FILES ɛŞʴ ſɐŵɐř ɎɎ ſɏɏ ɏɏŜɐŵŵŜɐƀƀŚ ɛŞʴſɐŵɐř ɎɎ ſɏɏ ɏɏƀƀŚ ɛʰ Ɏ ɎɎ
ɎſɛƀŚ ɛŞʴſɯɥɯɥƀŚ
INTERACTIVE LED
HTML FILE ʳŠʴ ʳʴ ʳʴ ʳʴ ʳŵʴ ʳŵʴ ʳʴ ʳ ʰɑŜŵ ŵɑʰɑɑʴ ʳʰɑɑʴʳŵʴ
ʳŵʴ ʳ ʰɑŜŵ ŵɑʰɑɑʴ ʳʰɑɑʴʳŵʴ ʳŵʴ ʳʰɑśɩɥɥŚśɫɥŚśŚɑ ʰɑśɑʰɑɑ ʳŵʴ ʳŵʴ
PHP SERVER Ɏ ɎɎ Ś ɛ Şʴ ſƀ Şʴſ ſƀſɛƀƇ ɛʰ ɎɎſɛŞʴƃɩɥƄƀŚ
ɛʰ ɎſƀŚ ɛŞʴ ſ ɐŵ ŵƇƈɐř ſ ɎɛřɛƀſɛƀƇ ſɛƃɐɐƄʰʰɐɐƀƇ ɛŞʴſƀŚ ɛʰɐɐŚ ƈƇ ɛŞʴſƀŚ
COLOR CIRCLE
SERVER ſƀſɛƀƇ ɛʰ ɎɎɎſ ɛŞʴƃɪƄřɛŞʴƃɬƄřɛŞʴƃɭƄ ƀŚ ɛʰ Ɏ ɎɎ ɎſƀŚ ɛŞʴ ſ ɐŵɐř
ſ ɎɛƀſɛƀƇ ɛ ʰſɛŞʴƃɐ ɐƄƀ ţɛŞʴƃɐ ɐƄśɐɤɥɥɥɐŚ ɛŞʴ ſɛ ƀŞʴſƀŚ ɛʰɛŞʴ ſƀŚ ɛŞʴ ʰ ɎɎɎſ ɐśɐŜɛ ƀŚ ɛŚ ƈ
REACTPHP Ƈ ɑɑśƇ ɑ ŵ ɑśɑɥŜɫŜƋɑ ƈ ƈ
RATCHET Ƈ ɑɑśƇ ɑ ŵ ɑśɑɥŜɪŜƋɑ ƈ ƈ
SENSOR PHALANX
SHIFTOUT()
SHIFTOUT() ɛʰ Ɏſ ɛŞʴƃɯƄř ɛŞʴƃɨɩƄř ɛŞʴƃɨɨƄ ƀŚ ɛŞʴ ſ ſƀſɛƀƇ
ɛʰɥŚ ɛŞʴſɛƀŚ ſʫʫɛʴɩɬɬƀƇ ɛʰɥŚ ƈ ƈř ɨɥɥɥ ƀŚ
7SEG DISPLAYS
MAX7219 8 Digit - 7Segment Display 8x8 Matrix Displays
ɛʰ ɎɎɮɩɨɰɎſ ɛřɨɨřɨɩřɯ ƀŚ ɛʰɫŚ ſɛʰɥŚɛʳɛŚɛʫʫƀƇ ɛŞʴſɛƋɯřɥƀŚ ƈ ɛʰ ſɏɏ ɏɏŜɐŵŞŜɐƀŚ ɛŞʴ ſɛřŞɨɮřɨɬɥƀŞʴſɥŜɬƀŞʴſƀŚ
I2C ſƀſɛřɛƀƇ ɛʰ ɎɎ ɩɎɨɨɬɩſ ɛɩ ʰ Ɏ Ɏ ɩſɛƀ ƀŚ ɛ Şʴſƀ
Şʴſ ſɛřɛƀƇ ɑśɑřɏſɛřɫƀřɑɎɑŚ ɑśɑřɏſɛřɨƀřɑɎɑŚ ƈ ƀ ƈ
THANKS https://joind .in/15483 https://github.com/ThomasWeinert/carica -chip
[email protected]