Raspberry Pi with Elixir, which is cooler than Python

This article is the 22nd day of "Raspberry Pi Advent Calendar 2020".

Yesterday, @ shion21's Mirroring from iPhone to Raspberry Pi! How to use RPiPlay.

nerves_hello_lcd_20201213_185620

Introduction

When I started Raspberry Pi two months ago, I chose [Elixir](https://ja.wikipedia.org/wiki/Elixir_(%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E8%A8%80%E8%AA%9E) as the programming language. I just liked the features and grammar of Elixir and wanted to use it for the IoT as well. In general, C and Python are often used. In that respect, there was an uneasy factor in doing Raspberry Pi with Elixir, but it was a story that it was a difficult move.

Elixir language and Nerves framework

Elixir is a programming language implemented on top of Erlang, which has a long track record of fault tolerance and high parallel performance. Recently, messages from around the world such as WhatsApp It is also used in apps, chat apps, etc., and I hear that its performance is drawing attention again. I heard that there is an IoT framework called Nerves that makes Elixir usable on Raspberry Pi, so I started studying. Elixir is more modern and cool to me than Python, and there's no reason not to use Elixir.

For more information about Nerves, @ takasehideki's "Slideshare: IoT with Elixir !? Now, Young and Cool Nerves Framework" is easy to understand. In addition, there is a community called "NervesJP" where study sessions are held. I am learning about Nerves at Nerves JP.

I was anxious for a moment

Most of the Raspberry Pi information in the world is written on the assumption that it uses C or Python, so I was confused when learning new things. For example, the other day I tried to practice showing "Hello" on the LCD display, but I couldn't find the Elixir material. Most used the existing C or Python libraries to operate the LCD.

The important thing is the communication protocol and product data sheet

After patiently researching and studying for a while, I noticed something. The contents of the C or Python library mentioned above are not a big deal, just the code as described in the LCD Data Sheet. It doesn't matter what the language is. What is really important is to learn the basics of communication protocols such as parallel communication vs. serial communication, I2C, SPI, and read the product data sheet with your own eyes and understand it as far as you can understand. I came to the conclusion that I would make an effort.

In IoT, I think that in the end, we often interact with hardware. Regarding that part, the programming language is irrelevant as long as serial communication such as I2C and SPI is possible. Even I, an amateur, could understand the outline, so if you read it carefully, anyone can do some operations (without relying on the library).

It was a mistake that I was only thinking about finding a library made by someone without reading the data sheet. It's good to have an existing library that you can use, but I think you need to understand the communication protocol and datasheets anyway.

at the end

It was a good experience. Even if it's not Python, you can freely enjoy Raspberry Pi in a cooler language. As long as I read the data sheet, I realized that there are some cases that can be done without a library, which made me feel refreshed. As a result, My own library was also created.

Results of operating LCD with Elixir is open to the public, so I hope everyone will enjoy Elixir and Nerves more and more.

Tomorrow is @ sho7650.

Recommended Posts

Raspberry Pi with Elixir, which is cooler than Python
Use vl53l0x with Raspberry Pi (python)
Working with GPS on Raspberry Pi 3 Python
Discord bot with python raspberry pi zero with [Notes]
I tried L-Chika with Raspberry Pi 4 (Python edition)
Get CPU information of Raspberry Pi with Python
Connect to MySQL with Python on Raspberry Pi
GPS tracking with Raspberry Pi 4B + BU-353S4 (Python)
Measure CPU temperature of Raspberry Pi with Python
What is Raspberry Pi?
DigitalSignage with Raspberry Pi
Try debugging Python on Raspberry Pi with Visual Studio.
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Display USB camera video with Python OpenCV with Raspberry Pi
Let's operate GPIO of Raspberry Pi with Python CGI
Mutter plants with Raspberry Pi
raspberry pi 1 model b, python
Python beginner opens and closes interlocking camera with Raspberry Pi
I tried running Movidius NCS with python of Raspberry Pi3
Create an LCD (16x2) game with Raspberry Pi and Python
Run BNO055 python sample code with I2C (Raspberry Pi 3B)
SSD 1306 OLED can be used with Raspberry Pi + python (Note)
Connect Raspberry Pi to Alibaba Cloud IoT Platform with Python
[Python] What is a with statement?
[Raspberry Pi] Stepping motor control with Raspberry Pi
Getting Started with Heroku-Viewing Hello World in Python Django with Raspberry PI 3
Control the motor with a motor driver using python on Raspberry Pi 3!
Servo motor control with Raspberry Pi
March 14th is Pi Day. The story of calculating pi with python
Golang vs. Python – Is Golang Better Than Python?
Serial communication with Raspberry Pi + PySerial
Which is better, PyPy or Python?
Try L Chika with raspberry pi
VPN server construction with Raspberry Pi
Get US stock price from Python with Web API with Raspberry Pi
Try moving 3 servos with Raspberry Pi
[Note] Using 16x2-digit character LCD (1602A) from Python with Raspberry Pi
Determining which OS is running Python
Using a webcam with Raspberry Pi
[Raspberry Pi] Changed Python default to Python3
I made a pet camera that is always connected with WebRTC (Nuxt.js + Python + Firebase + SkyWay + Raspberry Pi)
Detect analog signals with A / D converter using python on Raspberry Pi 3!
CSV output of pulse data with Raspberry Pi (confirm analog input with python)
Use python on Raspberry Pi 3 to light the LED with switch control!
[Python + PHP] Make a temperature / humidity / barometric pressure monitor with Raspberry Pi
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
RabbitMQ message notification app in Python with Growl ~ with Raspberry Pi and Julius ~
Communicate between Elixir and Python with gRPC
Measure SIM signal strength with Raspberry Pi
Pet monitoring with Rekognition and Raspberry pi
Detect "brightness" using python on Raspberry Pi 3!
Raspberry Pi Security Infrared Camera (Python Edition)
Hello World with Raspberry Pi + Minecraft Pi Edition
Build a Tensorflow environment with Raspberry Pi [2020]
Adafruit Python BluefruitLE works on Raspberry Pi.
Get BITCOIN LTP information with Raspberry PI
Try fishing for smelt with Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
Improved motion sensor made with Raspberry Pi
Try Object detection with Raspberry Pi 4 + Coral
Run servomotor on Raspberry Pi 3 using python