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
Getting started with the spark core
Search
claudiomettler
January 14, 2015
Technology
1
280
Getting started with the spark core
For Hackware v0.3
claudiomettler
January 14, 2015
Tweet
Share
More Decks by claudiomettler
See All by claudiomettler
On-demand image scaling with AWS Lambda and S3
claudiomettler
0
140
Terraform in 5 minutes
claudiomettler
0
730
Intro to Xdebug
claudiomettler
0
200
chef talk at DevOps Singapore
claudiomettler
0
140
Other Decks in Technology
See All in Technology
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
210
Work as an App Engineer
lycorp_recruit_jp
0
330
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
290
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
型情報を用いたLintでコード品質を向上させる
sansantech
PRO
2
120
pg_bigmをRustで実装する(第50回PostgreSQLアンカンファレンス@オンライン 発表資料)
shinyakato_
0
110
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
130
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
230
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
240
Server-Side Engineer of LINE Sukimani
lycorp_recruit_jp
0
320
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
Practical Orchestrator
shlominoach
186
10k
Building Your Own Lightsaber
phodgson
103
6.1k
Raft: Consensus for Rubyists
vanstee
137
6.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
A Tale of Four Properties
chriscoyier
157
23k
Optimising Largest Contentful Paint
csswizardry
33
3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Optimizing for Happiness
mojombo
376
70k
Designing for humans not robots
tammielis
250
25k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Transcript
getting started with the spark core 1
2
hardware • 72MHz ARM Cortex M3 • TI CC3000 WiFi
• 7 analog IO (pwm out), 7 digital IO • ~ S$ 55 • coming soon: Photon, 120MHz, Broadcom Wifi, half the price 3
setup, the easy and unreliable way • install smartphone app
• power up spark • use smartphone app to create cloud account and register the core 4
setup, the better way (USB) npm install spark-cli spark setup
5
ready? • your spark core should have a name and
be breathing cyan by now 6
the tinker firmware • default firmware of spark core •
allows access to all inputs/outputs 7
let’s ask the cloud export SPARK_CORE_ID=53ff71065075535128311587 export SPARK_ACCESS_TOKEN=[get this from
https://spark.io/ build or “spark login”] 8
let’s ask the cloud curl -H "Authorization: Bearer $SPARK_ACCESS_TOKEN” https://
api.spark.io/v1/devices/$SPARK_CORE_ID/ Alternatively include the token in the URL: https://api.spark.io/v1/devices/$SPARK_CORE_ID/?access_token= $SPARK_ACCESS_TOKEN 9
output { "id": "53ff71065075535128311587", "name": "schnitzel", "connected": true, "variables": {},
"functions": [ "digitalread", "digitalwrite", "analogread", "analogwrite" ], "cc3000_patch_version": "1.29" 10
using functions curl https://api.spark.io/v1/devices/$SPARK_CORE_ID/ digitalwrite?access_token=$SPARK_ACCESS_TOKEN -d params=D7,LOW or include access_token
in POST data: curl https://api.spark.io/v1/devices/$SPARK_CORE_ID/ digitalwrite -d access_token=$SPARK_ACCESS_TOKEN -d params=D7,LOW 11
response { "id": "53ff71065075535128311587", "name": "schnitzel", "last_app": null, "connected": true,
"return_value": 1 } 12
the cloud API • events, functions, variables • http://docs.spark.io/api/ 13
the javascript API • runs in browser and in nodejs
• (npm|bower) install spark • http://docs.spark.io/javascript/ 14
voodoospark • alternative firmware • faster communication through local TCP
connection • npm client module • still uses cloud for facilitating local connection 15
DIY, noob mode 16
DIY, noob mode #2 17
DIY spark compile myapp.ino spark flash firmware_1421160254713.bin 18
DIY, hardcore mode brew tap PX4/homebrew-px4 brew update brew install
gcc-arm-none-eabi-48 brew install dfu-util git clone https://github.com/spark/core-firmware.git git clone https://github.com/spark/core-common-lib.git git clone https://github.com/spark/core-communication-lib.git 19
DIY, hardcore mode 20
DIY, hardcore mode cd core-firmware/build make 21
flash via USB • press&hold mode button, tap and release
RST button until LED flashes yellow • spark core is now in DFU mode 22
flash via USB make program-dfu 23
flash via cloud make program-cloud 24
create your own app mkdir core-firmware/applications/myapp vim core-firmware/applications/myapp/application.cpp cd core-firmware/build
make APP=myapp make APP=myapp program-dfu # or program-cloud 25
app structure #include "application.h" int example(String command); void setup(){ //
set up cloud functions & variables, IO pin modes Spark.function("example", example); pinMode(D7, OUTPUT); } void loop(){ // called continuously } int example(String command){ digitalWrite(D7, HIGH); delay(2000); digitalWrite(D7, LOW); return 1; } 26
app structure { "id": "53ff71065075535128311587", "name": "schnitzel", "connected": true, "variables":
{}, "functions": [ "example" ], "cc3000_patch_version": "1.29" 27
documentation • http://docs.spark.io/firmware/ 28
my current project 29
my current project • websockets • static site hosted on
S3 • direct connection from browser to spark • https://github.com/ponyfleisch/cloudlamp 30