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
520
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
180
Introduction: PHP Extensions
thomasweinert
2
790
PCRE - Matching Patterns
thomasweinert
0
110
PCRE With PHP
thomasweinert
0
650
Modern PHP
thomasweinert
3
210
Controlling Arduino With PHP
thomasweinert
1
140
XPATH WITH PHP AND JS
thomasweinert
0
93
PHPUG CGN: Arduino With PHP
thomasweinert
0
120
IPC 2013: Controlling Arduino With PHP
thomasweinert
0
200
Other Decks in Programming
See All in Programming
rails newと同時に型を書く
aki19035vc
5
710
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
1k
為你自己學 Python
eddie
0
520
2025.01.17_Sansan × DMM.swift
riofujimon
2
540
선언형 UI에서의 상태관리
l2hyunwoo
0
270
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
180
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
1.8k
return文におけるstd::moveについて
onihusube
1
1.4k
AIレシート読み取り機能をRuby on Rails on AWSで実現するLLMにまつわるアレコレ / AI-based receipt reading function powered by LLM on Ruby on Rails on AWS
moznion
3
130
BEエンジニアがFEの業務をできるようになるまでにやったこと
yoshida_ryushin
0
190
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
700
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
390
Featured
See All Featured
It's Worth the Effort
3n
183
28k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
The World Runs on Bad Software
bkeepers
PRO
66
11k
How GitHub (no longer) Works
holman
312
140k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Cult of Friendly URLs
andyhume
78
6.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
Navigating Team Friction
lara
183
15k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
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]