6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Scenic with Nerves(Elixir)

Last updated at Posted at 2020-06-23

はじめに

  • Scenicは、Elixir/Erlang/OTP stackで直接書けるアプリケーションフレームワークです
  • Nervesは、ElixirのIoTでナウでヤングなcoolなすごいヤツ! です

準備(公式)

参考記事

私が使ったバージョン

$ asdf current
erlang 23.0.1
elixir 1.10.3-otp-23

Getting Started with Nervesを参考になぞってみる

$ mix scenic.new.nerves my_app
$ cd my_app
$ export MIX_TARGET=rpi2
  • mix scenic.new.nervesしたときにconfig/rpi3.exsはできてはいます
  • 私はRaspberry Pi 2しかもっていない。。。
  • config/rpi2.exsがない状態でmix deps.getすると、以下のエラーが発生しました
$ mix deps.get
** (Code.LoadError) could not load /Users/torifuku/Documents/13_Elixir/Scenic_with_Nerves/my_app/config/rpi2.exs
    (elixir 1.10.3) lib/code.ex:1397: Code.find_file/2
    (elixir 1.10.3) lib/code.ex:871: Code.eval_file/2
    (mix 1.10.3) lib/mix/config.ex:158: anonymous fn/2 in Mix.Config.__import__!/2
    (elixir 1.10.3) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.10.3) lib/mix/config.ex:157: Mix.Config.__import__!/2
    (stdlib 3.12.1) erl_eval.erl:680: :erl_eval.do_apply/6
  • 気を取り直して
  • コピーすればいいのだろう、きっと! :rocket:
$ cp config/rpi3.exs config/rpi2.exs 
$ mix deps.get
$ mix firmware
$ mix firmware.burn
  • こんがりやきあがったmicroSDカード:fire::fire::fire:をRaspberry Pi 2に差し込んで、HDMIでテレビ:tv:とつなげてみました
  • lib/scenes/sys_info.exにかいてある文字列がテレビ:tv:に写りました!
MIX_TARGET: rpi2
MIX_ENV: dev
Scenic version: 0.10.2
Please note: because Scenic
draws over the entire screen
in Nerves, IEx has been routed
to the UART pins.

Wrapping Up

  • とりあえず(たぶん)、Nerves上でScenicを動かせました :rocket::rocket::rocket:
  • Enjoy!
6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?