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
170
Introduction: PHP Extensions
thomasweinert
2
780
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
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Amazon Qを使ってIaCを触ろう!
maruto
0
400
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
870
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Macとオーディオ再生 2024/11/02
yusukeito
0
370
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
100
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Remix on Hono on Cloudflare Workers
yusukebe
1
280
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
Outline View in SwiftUI
1024jp
1
320
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Featured
See All Featured
Being A Developer After 40
akosma
86
590k
BBQ
matthewcrist
85
9.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Designing for Performance
lara
604
68k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Building Your Own Lightsaber
phodgson
103
6.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Facilitating Awesome Meetings
lara
50
6.1k
Speed Design
sergeychernyshev
24
610
Designing for humans not robots
tammielis
250
25k
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]