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.
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 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.
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.
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.
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