thovoll

thovoll

Hi,

Does anyone have experience running Scenic with Nerves on RPi3, with display output going to a smaller screen that fits on top the the RPi3?

There’s quite a few ways to connect a display to an RPi3 and it’s unclear to me which ones are compatible with Scenic+Nerves.

From looking through the ads and docs of some displays, it seems they need a special driver or library. Curious if anyone has gotten one to work with Scenic+Nerves.

I did get Scenic+Nerves to draw on a regular computer monitor attached to the RPi3 via HDMI.

Thanks for any pointers,
Thomas

Showing Posts 1 to 10

axelson

axelson

Scenic Core Team

Hi! I have the officialRaspberry PI touch display (from the ElixirConf nerves training) and it’s working great with Scenic (I even have touch working!). I didn’t have to do any special setup except for configuring scenic_driver_nerves_touch.

If you want to look at my code it’s available here: GitHub - axelson/scenic_asteroids: A toy Asteroids clone written in Elixir with the Scenic UI library · GitHub

Although it won’t work without a little tweaking because I have a few external path dependencies in there.

Edit: Now there aren’t any path dependencies, so everything should work fine.

thovoll

thovoll OP

Great, thanks! I’m looking for something smaller though, around 3.5 or 4 inch so the display fits on top of the RPi3 :slight_smile:

Something like this: Amazon.com
Or like that: PiTFT Plus 480x320 3.5 TFT+Touchscreen for Raspberry Pi : Adafruit Industries, Unique & fun DIY electronics and kits

axelson

axelson

Scenic Core Team

Okay, I see. I don’t have experience with that unfortunately, but I’m sure someone will chime in!

piex

piex

Are you using a keyboard with the rpi3? I have an rpi3 and the same touch screen plus a USB keyboard but I am not getting any keyboard events via handle_input/3 in my scene code. Works fine on MacOS, but on rpi no keyboard events.

Also haven’t figured out how touchscreen events work with the handler model in Scenic scenes, does it also work with handle_input/3? what to pattern match on? Any advice?

axelson

axelson

Scenic Core Team

Haven’t tried connecting a keyboard since I don’t have a spare one at the moment and I’ve been too lazy to steal one from a computer.

My top-level handle_input captures everything:

  def handle_input(input, viewport_context, state) do
    Logger.info("Received input: #{inspect input}")
    do_handle_input(input, viewport_context, state)
  end

Then the do_handle_input clauses matches on {:cursor_pos and {:cursor_button:

  # Mouse/Touchscreen drag input
  def do_handle_input({:cursor_pos, cursor_coords}, _viewport_context, state) do
    {:noreply, update_cursor_coords(state, cursor_coords)}
  end

  # Mouse Click/Touchscreen tap input
  def do_handle_input({:cursor_button, {:left, :press, _, cursor_coords}}, _viewport_context, state) do
    # track tap
  end

Have you used RingLogger to view logs from the device? The logging is the main reason that I keep the top-level handle_input around. If you have ring logger installed you can ssh into your raspberry pi and run RingLogger.tail or RingLogger.attach to view the logs.

If you want to try out my code it’s released as MIT: GitHub - axelson/scenic_asteroids: A toy Asteroids clone written in Elixir with the Scenic UI library · GitHub It’s a little asteroids clone that’s most of the way done (although there’s no way to move around on a device, unless a keyboard works, also I should rename my repository).

If you cd fw; mix deps.get; mix firmware; and then upload the firmware to your device it should work.

Also are you running your scenic program locally as well? Or just on-device?

fhunleth

fhunleth

Co-author of Nerves

Sadly, I don’t think anyone has written a non-touch input driver for Scenic on Nerves yet. The input driver at scenic_driver_nerves_touch only looks for a touchscreen sensor and processes events from it.

It seems like there could be a driver receives input from all input devices and sends them through Scenic. The input_event library looks like some code could enumerate the input sources and then start a listener on all of them. I haven’t studied the glue code to scenic, but I’d hope that the touch driver could serve as a good guide.

piex

piex

Thanks for the info. I now have things set up with nerves init-gadget, firmware_ssh, etc and started using RingLogger over ssh. Your code examples were helpful, thanks again.

axelson

axelson

Scenic Core Team

Great! I’m glad it was helpful :smile:

thovoll

thovoll OP

To get started, I went ahead and got the official 7" Raspberry Pi screen and a matching stand. This setup will actually be better for my current needs :slight_smile: We’ll see where it goes later. Next step for me is to learn more Scenic and read analog input from a linear poti.

fhunleth

fhunleth

Co-author of Nerves

Update on input events to Scenic: I just submitted a PR to the input_event library to support generically identifying keyboards, mice, joysticks, touchscreens, and the other random things that show up as input devices like audio input jack detectors and power buttons. Hopefully once it gets merged (it is a big change, so might take a bit), someone can help add the Scenic driver pieces to make it work.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews