Raspberry Pi 4 GPIO

32 views
Skip to first unread message

Larry Rix

unread,
Jul 26, 2020, 9:43:28 PM7/26/20
to Eiffel Users
SUCCESS!

My breadboard kit with dozens of circuits to build and control arrived yesterday.

I already had a successful installation of Eiffel 19.05 GPL on the RPi4, but now I needed to get the WiringPi library installed together with the project tutorial and sample C/Python code installed. This was pretty easy to do even though the instructions are clearly written by someone from China who has less than stellar English skills.

Nevertheless—I endeavored to get the very first project running first in pure C per the tutorial and then to use that as a basis for creating a mirror test project in Eiffel that does precisely the same thing.

SUCCESS!

The little project is called BLINK because all one wants to do is write up a single LED on the breadboard and get it to blink on and off every second. The C code came together with a small learning curve about gcc options.

What I learned there was easily applied to an Eiffel project, where I included the usr/include folder and an appropriate C compiler option, and then use external C wrapper features around 3 separate C functions.

The result is that I now have an Eiffel executable that runs and works precisely like its pure C counterpart, but with all of the beauties of Eiffel!

I am SO HAPPY!

The goal of this project is to ultimately provide sample Eiffel code to the manufacturer of this breadboard kit so that Eiffel is included in their deliverable to people so they can experiment with the Eiffel as well as the C, Python, and Java.

The goal beyond that is to be able to use Raspberry Pi GPIO electronics to sense and control physical elements for robotics or whatever.

My next step is to see if I can get WrapC to build out the wrappers instead of coding them by hand. We shall see how I do!

Happy Eiffel-ing!

Louis M

unread,
Jul 27, 2020, 1:34:34 AM7/27/20
to eiffel...@googlegroups.com

Hi Larry,

Two things:

First, if this is something that can interest you, some years ago, I created a Eiffel cross-compiler for raspberry pi. You can find it there: https://github.com/tioui/Eiffel_Spec/tree/master/raspbian-spec .

Second, the WiringPi library is really powerful, but right now, you can easily use Eiffel to control de Raspberry Pi GPIO by using the SYSFS GPIO mapper. It is as easy as opening a file and writing (or reading) something in it. You can control LED, motor, button, switch, etc. It cannot control analog control or IO synchronization. You can easily find resources on the internet about this method. The first result that DuckDuckGo gave me seems legit enough (https://www.ics.com/blog/gpio-programming-using-sysfs-interface).

Good day,

Louis M

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/510a232c-78ec-47e3-8a0f-9056a3f59e48n%40googlegroups.com.

Larry Rix

unread,
Jul 27, 2020, 8:31:42 AM7/27/20
to Eiffel Users
Hi Louis!

Thank you for the feedback. I will have to circle back to take a peek at what you have suggested. For the moment, I will use the ES 19.05 install/IDE plus the wiringPi—mostly because I have it working and the tutorial from Freenove is tightly coupled with wiringPi C. For me, this is a learning curve of:

1. ES on the RPi-4
2. Wrap C on the wiringPi C API
3. Use of wiringPi to engage the electronics

Thankfully, Javier and Jocelyn have already taken me partway down the Wrap C road, so I am pretty comfy here. The real new part is controlling the electronics and building enough of a wiringPi Eiffel library (project) to where the tutorial from Freenove can be successfully implemented.

Nevertheless—your suggestions are welcomed and I will circle back at a later time.

This all leads to a question: Is there any advantage of your Eiffel cross-compiler over the RPi arm7 installation from Eiffel Software?

Thanks,

Larry

Louis M

unread,
Jul 27, 2020, 10:23:40 AM7/27/20
to eiffel...@googlegroups.com
On 2020-07-27 8:31 a.m., Larry Rix wrote:
> This all leads to a question: Is there any advantage of your Eiffel
> cross-compiler over the RPi arm7 installation from Eiffel Software?

Well, I see two advantages. The first is, of course, performance.
Compiling on the Raspberry Pi is generally quite long compared to a
compilation on PC. The other advantage is when your installation is not
optimal to connect the raspberry PI on a PC. For instance, when it is
connected to a breadboard on a big table or a workbench or something
like that and that you don't have a screen, keyboard and mouse at that
location. Then, you can compile on PC and put the binary over SSH on the
Raspberry Pi.

But it was only to let you know that it does exist.

Good day,

Louis M

Larry Rix

unread,
Jul 28, 2020, 6:56:04 AM7/28/20
to Eiffel Users
Oh, I see! I think I was missing some information in your first message. It is now clear that by cross-compiler, you mean that you have a compiler that runs on my PC (Intel CPU), but compiles for ARM7/8? Therefore, I can do quicker compiles on the faster PC and then push the executable through SSH to the RPi4, yes?

Larry Rix

unread,
Jul 28, 2020, 4:58:08 PM7/28/20
to Eiffel Users
https://youtu.be/cHoEdV19Alw

A video of an Eiffel + RPi4 project in practical use.

Louis M

unread,
Aug 1, 2020, 6:28:16 PM8/1/20
to eiffel...@googlegroups.com

Yes!

Louis M

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.

Gachoud Philippe

unread,
Aug 2, 2020, 9:43:40 AM8/2/20
to eiffel...@googlegroups.com
Actually for me it would be that simple, a compilation of my project on a rpi takes 58 minutes.... on a computer it would take so much less time....



--
**********************************************
Philippe Gachoud
Puerto Williams 6657
Las Condes
Santiago de Chile
RUT: 26374747-k
**********************************************
Reply all
Reply to author
Forward
0 new messages