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
780
PCRE - Matching Patterns
thomasweinert
0
110
PCRE With PHP
thomasweinert
0
630
Modern PHP
thomasweinert
3
210
Controlling Arduino With PHP
thomasweinert
1
140
XPATH WITH PHP AND JS
thomasweinert
0
91
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
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
150
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
270
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
490
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
220
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
Recoilを剥がしている話
kirik
5
6.9k
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
140
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
340
MCP with Cloudflare Workers
yusukebe
2
220
Go の GC の不得意な部分を克服したい
taiyow
3
800
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
210
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
A better future with KSS
kneath
238
17k
Designing for Performance
lara
604
68k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Building Adaptive Systems
keathley
38
2.3k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
The Invisible Side of Design
smashingmag
298
50k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
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]