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
610
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
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
980
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
現場で役立つモデリング 超入門
masuda220
PRO
13
3k
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.7k
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
660
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
400
CSC305 Lecture 13
javiergs
PRO
0
130
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
360
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
200
CSC509 Lecture 09
javiergs
PRO
0
120
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
170
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
The Language of Interfaces
destraynor
154
24k
Designing for Performance
lara
604
68k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Git: the NoSQL Database
bkeepers
PRO
426
64k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
How to Think Like a Performance Engineer
csswizardry
19
1.1k
A designer walks into a library…
pauljervisheath
202
24k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
It's Worth the Effort
3n
183
27k
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]