Click on image for video. Switching rainbow/purple/red/rainbow done via OpenC2 commands.
Demo code for talk on IoT Safety. Blinky - the "Hello World" of IoT. HaHa - the "Hello World" of OpenC2.
It is made from (need to fill in) nerves phoenix example, openc2 lycan, blinkchain
Master branch is 'rainbow' config for 8x8 matrix (don't forget "export MIX_TARGET=rpi0")
String50 branch is for string of 50 leds (don't forget "export MIX_TARGET=rpi4")
Blinkt branch is for 8x1 Pimoroni Blinkt! pi-hat
Hardware config for string:
- attach purple wire to rpi4 gpio pin 12 (BCM 18/PWM0)
- attach blue wire to rpi4 gpio pin 14 Ground
- Yellow wire should already be connected to strip middle connector
- connect power to rpi4 and strip
This example demonstrates a basic poncho project for deploying a Phoenix
Framework-based application to a Nerves device. A "poncho project" is similar
to an umbrella project except that it's actually multiple separate-but-related
Elixir apps that use path
dependencies instead of in_umbrella
dependencies.
You can read more about the motivations behind this concept on the
embedded-elixir blog post about Poncho Projects.
This example serves a Phoenix-based web page over the network. The steps below
assume you are using a Raspberry Pi Zero, which allows you to connect a single
USB cable to the port marked "USB" to get both network and serial console
access to the device. By default, this example will use the virtual Ethernet
interface provided by the USB cable, assign an IP address automatically, and
make it discoverable using mDNS (Bonjour). For more information about how to
configure the network settings for your environment, including WiFi settings,
see the vintage_net
documentation.
-
Connect your target hardware to your host computer or network as described above
-
Prepare your Phoenix project to build JavaScript and CSS assets:
# These steps only need to be done once. cd ui mix deps.get cd assets npm install
-
Build your assets and prepare them for deployment to the firmware:
# Still in ui/assets directory from the prior step. # These steps need to be repeated when you change JS or CSS files. node node_modules/webpack/bin/webpack.js --mode production cd ../ mix phx.digest
-
Change to the
firmware
app directorycd ../firmware
-
Specify your target and other environment variables as needed:
export MIX_TARGET=rpi0 # If you're using WiFi: # export NERVES_NETWORK_SSID=your_wifi_name # export NERVES_NETWORK_PSK=your_wifi_password
-
Get dependencies, build firmware, and burn it to an SD card:
mix deps.get mix firmware mix firmware.burn
-
Insert the SD card into your target board and connect the USB cable or otherwise power it on
-
Wait for it to finish booting (5-10 seconds)
-
Open a browser window on your host computer to
http://nerves.local/
-
You should see a "Welcome to Phoenix!" page
- Official docs: https://hexdocs.pm/nerves/getting-started.html
- Official website: https://nerves-project.org/
- Discussion Slack elixir-lang #nerves (Invite)
- Source: https://github.com/nerves-project/nerves