Libgpiod vs pigpiod vs wiringPi

Hi Jeff,

Glad to see that the example works for you.

The general format of the book will likely remain the same (commands, electronics fundamentals, transistor-transistor-logic), and the parts that will definitely change is the code. An example is pigpio_start does not exist in the new library and instead uses lgGpiochipOpen. In general the same ‘type’ of steps exist, where the board is opened, pins are selected as input/putput, and then each pin is assigned a value through a write command.

ok, lol. I printed out the book/pdf. I look forward to the update. :+1:t2:

Thats alot of paper :slight_smile:

It going to take a while for the update (months?) if everything goes well. If there is a major issue with either the programming language or the library then this could take considerably more time to fix (years?). From the old saying “A bird in the hand is worth two in the bush” :slight_smile:

1 Like

Ok, I’ll continue with the current doc and library builds. Thanks, Eugene.

Does this new library support access to the serial ports, or for bit banging on a regular pin to make a software serial port? I was also using the weird scripting available in pigpio to do things like pwm fades on pins via the remote server. I suppose if I want a server process for the new library I’ll need to write my own and install it on the pi and build a new interface to it for the remote app? I really liked the server functionality of it as well.

That being said it was not entirely reliable and the serial port stuff was hit or miss as far as reliability. I’ve got one machine where the pigpiod process goes to 100% of a CPU core even though it’s not actually doing anything.

@James_Sentman

My first presumption is it ‘should’, although I haven’t created an example yet. When I look on the website (lg library) the features are:

I optimistically think it should support access to the serial ports and bit banging. Being that this is calling pure C code, then there should be less resources being consumed. As you mentioned, data over a serial port shouldn’t consume 100% of the CPU.

1 Like

I stoped using Xojo for GPIO, it was a lot of trouble to have decent response to multiple events. Does the new lib have better support for real time events in xojo?

Very much hoping the new book will describe how to do “real” SPI rather than bit-banging.

1 Like

Hi Ivan,

The events seems to work well in other programming languages, and there seems to be issues in Xojo. The short answer is, I don’t know about the response time in Xojo with multiple events.

Could you provide me with a simple example? I am just making this example up: Reading 3 distance sensors on a robot to make sure it doesn’t run into wall.

Thanks Julia. I’ll look into this a little more and see what I can do. Thanks for the good suggestion :slight_smile:

1 Like

After thinking a little more about Julia’s great request, are there other areas that should be looked at when I am working on the lgpio library?

If its something easier to work with, such as real-SPI then I can definitely look at it. If the request is something like: create a robot, or make a room scanner, then this is likely a larger project that would be considered as a separate project. There are no promises :slight_smile:

1 Like

That looks fantastic actually I should be able to adapt the current source to use the new libraries. The 100% CPU thing I don’t think has anything to do with the serial ports, it’s just how I’ve found it sitting there sometimes even when it’s not doing anything. I will definitely put this on my list to start experimenting with soon.

1 Like

Hi Julia,

Over the last few days I tried to have SPI work and unfortunately was not able to make it work with Xojo.

Here is the code in python that I could make it work with the pigpio library.

Maybe I’ll be able to get it to work in the future with Xojo.

Well, that stinks, but thanks for trying. Bit-banging in 2021 with computers more powerful than the supercomputers of a couple of decades ago :frowning: How about UART - same thing?

1 Like

@Julia_Truchsess,

I created an example program that works with PIGPIO and SPI. The converted code from the above Python code is shown below:

Below is the main event in a button action event:

This uses SPI (CE0) on a MCP3008 to measure the voltage (3.3v reference). I have only been able to read one of the pins, and its a start and doable. :slight_smile:

1 Like

Version 1.17 of the free pigpio-GPIO library has been updated to Version 1.17 (7 Jan 2021) with the three new methods used in this example.

The free github file can be downloaded here:

2 Likes

That’s great, thanks so much @Eugene_Dakin for persevering!

1 Like

Hello Everyone,

Just a friendly update. I have been able to start working on the Libgpiod library and am working on a book with Xojo functions. I am impressed with the speed of the library so far.

Here is the link to the starting functions of the libgpiod library, and it will continue to be updated as I write more examples in the book.

My wild guess is that the book will be ready in 6 months or so and it is written with Xojo API 2.0 language and API 2.0 controls.

As a side note, could Xojo call Xojo API with the language changes API 2.0, and Xojo API with the control changes API 2.1? It would make it much easier to answer questions from colleagues and prevent miscommunication.

3 Likes