Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 2.05 KB

README.md

File metadata and controls

68 lines (49 loc) · 2.05 KB

HelloSqlite

This example demonstrates a basic project for using the Ecto SQLite Adapter.

See scheduler_usage_poller.ex for an example of Sqlite being used.

Hardware

The example below assumes a Raspberry Pi 0 connected over the USB. Other official and many unofficial Nerves targets work as well.

How to use this repository

  1. Go to the hello_sqlite directory

  2. Set up your build environment

    # Specify the target hardware. See the mix.exs for options
    export MIX_TARGET=rpi0
    
    # To hard-code WiFi credentials in the firmware, you can set
    # the SSID and optionally a password here
    export WIFI_SSID=your_wifi_name
    export WIFI_PASSPHRASE=your_wifi_password
  3. Get dependencies, build firmware, and burn it to an SD card

    mix deps.get
    mix firmware
    mix firmware.burn
  4. Insert the SD card into your target board and power up

  5. Wait to finish booting.

  6. SSH into the board: ssh nerves.local

  7. from the IEx prompt

# Get 5 entries from the SchedulerUsage table and print them out
HelloSqlite.print_recent(5)
 +------------------------------------------------------+
 |                   Scheduler Usage                    |
 +---------------------+---------+----------------------+
 | Timestamp           | Percent | Util                 |
 +---------------------+---------+----------------------+
 | 2021-04-07 14:53:27 | 0.0     | 4.61004300282592e-5  |
 | 2021-04-07 14:52:56 | 0.0     | 1.968093695606747e-5 |
 | 2021-04-07 14:52:25 | 0.0     | 8.095389473073943e-5 |
 | 2021-04-07 14:51:54 | 0.0     | 9.218367384342268e-6 |
 +---------------------+---------+----------------------+
:ok

Learn More