Is Pi GPIO Support Dead?

I’m doing a project where I wanted a little more than what I could get with arduino. I’m a xojo coder so I ordered my pi, touchscreen and accessories and got my free license for xojo pi, and cracked my nuckles. I’m all set up ready to code today and now I’m finding so very little information about how to do anything other than blinking an led. Most of the samples and videos are from 5 years ago or so. And google doesnt return much more than those initial examples. The GPIO/Classes in the example has LED RGBLED and Servo. (No Serial?)

So I came to the forum to look and it seems like Xojo got really excited about pi support 5 years ago and then forgot about it. And also maybe there just isn’t a big enough community to get it to where arduino libraries are. And now I see that wiringPi is deprecated and replaced with pigpio. But no tutorials or anything on how to get that to work, or if it’s seamless and just works and all the old examples (I mean the 2 blinking examples) will still work or what. The thread I did find on pigpio has people trying to get it to work. And of course the Pi Book is outdated. Even the examples under new project are wiringpi and not pigpio.

Basicaly I need to control some actuators with xojo over can bus. They are smart actuators so I just tell them where to go and how. I have a can bus modue that I got working fine in arduino and had motors moving in about an hour. I connects serial over 2 pins and ground. And in arduino I’m using a library called Serial_CAN_Module. But I don’t even see a Serial library for xojo, much less anything about Can Bus.

I see a few possible outcomes here:

  1. I’m just missing something stoopid and there are more xojo gpio classes that I’m not finding yet.

  2. I have to write everything from scratch or port these other libraries over.

  3. I’m going to need to write all my gpio stuff in python and somehow call those from the xojo UI. But I have never programmed in python so I’m not excited about the learning curve on that solution.

  4. Fall back to arduino (which I don’t think is powerful enough) and have the pi ui tell the arduino what to do over serial. In arduino I’ve had issues with floating point numbers and for this project precision is important.

Maybe this is the solution…

Have you looked at the following blog:

1 Like

Hi Michael,

I am glad to see that you enjoy programming Raspberry Pi with Xojo. Bjorn at has really good free tutorials to program the Raspberry Pi.

In the past, there were many samples and bits-and-bobs of information about Xojo and Raspberry Pi, which were difficult to find and became outdated due to a few factors: 1) Xojo’s switch to API 2, 2) Frequently released Raspberry Pi’s (2B, then 3B, then 3B+, and then 4B), and 3) the deprecation of wiringPi.

My solution was to: 1) write books with a wide variety of examples for different Raspberry Pi editions (Books), 2) write examples in Xojo with the latest version of Xojo (Some API1 and some API2), and 3) create a free pigpio library wrapper (GitHub - eugenedakin/pigpio-GPIO: Code for Xojo apps to access the Raspberry Pi GPIO pins through the).

Since this work does require both time and funds to purchase electronics, I had to charge a small amount for the book. The feedback to my personal account has been fantastic and people share the incredible things that they have built.

Does Xojo do everything? Of course it can’t and neither can most languages. This is a start to programming electronics for mostly beginner and medium strength programmers, with a few examples for advanced programmers.

PIGPIO is updated, and works well on the Raspberrry Pi 4B, and some of the older Raspberry Pi’s. If you run into issues, feel free to ask a question on this forum, and you will likely get the answers to your questions. If you are involved in a very large project, then you may want to submit a consulting request for additional help.

There is a really good chance that there will be a future version of the Raspberry Pi (maybe Pi 5b???), and this will also give me the opportunity to update all of the examples in the book to API2. Until then, the latest version has current examples for Raspberry Pi 4B.

I hope this answers your questions, and the helpful community is here to guide Xojo enthusiasts.


Edit: Oh I forgot to mention, you can download the table-of-contents for each book on my website to preview some of the topics, so that you can make a better-informed decision. :slight_smile:

1 Like

Awsome thanks. Bought it and am reading it now.

Hey so I don’t have the breakout breadboard thingy. I’m just use the pins directly on the Pi. So when one of the examples says to use pin18, or in code when you do

Call pi.gpio_write(18, pi.ON)

Is that 18 referring to pin 18 (which is GPIO24) or GPIO18 which is pin 12? I’m assuming the later. Guess I’ll know in a minute. :boom:

Sorry one more quesiton. Is there a way to set a pin to be an input with a built in pullup like there is in arduino? Like this:

It’s super handy to be able to skip all the pullup resisters. Thanks.

You are correct, GPIO pin 18 is pin 12. A picture is shown on Page 25 of the book.

1 Like

Yes, Example 5-4 and Example 5-5 in the book show how to use a Pull Up and Pull Down internal resistor. An example of the command is:

1 Like

Eugene thanks for putting up with me. I have another question.

I got the led on/off example working. So thanks for your help so far. I’m moving along.

Which of the examples in your book would get me closest to communicating serial to another device? The arduino Serial_CAN_Module library is really just using arduino’s SoftwareSerial. SO is there something similar to the softwareserial library in the pigpio? Any examples? Thanks.

I looked over the book and the Einhuger site and didn’t see anything about serial and I don’t see it in the pigpio methods.

Wouldn’t this just be using the Xojo serial capabilities?

1 Like

It looks like the Serial_CAN_Module is a specialized communication protocol for reading vehicle computer error codes. Since a library has already been developed (maybe this one?: GitHub - Longan-Labs/Serial_CAN_Arduino), my suggestion would be to use an Arduino to gather the information from the vehicle with the library, then send the decoded data to a Raspberry Pi and create the interface to be human-readable.

After you have been able to fine-tune the programs, then you could develop your own Raspberry Pi library to interface directly.

Another option is to see if another library exists for the Raspberry Pi and interface with it. An example would be to use an existing Python library that interfaces the Raspberry Pi with the Serial_CAN_Module and then send the information to Xojo to show the data in the GUI.

I don’t know of anyone who has created a Serial_CAN_Module for Raspberry Pi with Xojo, yet.

I think maybe so. With arduino we do software serial because the main serial ftdi/usb port is connected to the mac. But with the Pi I guess I don’t need software serial. I was researching that last night.

Pins 8 and 10 (GPIO 14,15). And I have read about how to turn these on and turn off them being the linux console (here). But where in xojo software do I access these? Just use SerialConnection? I’ll experiment to see if I can figure out how to use those pins using SerialConnection or SerialDevice.

So actually what I’m doing has nothing to do with cars or computer codes. Can Bus is the protocol to control these motors…

And can bus is basically a different flavor of rs485. But I have a Can Bus bridge that I can talk to serial. Porting over the Serial_Can_Bus library would be fairly easy and I should be able to do that today. I just need to have a serial connection that I can bring out of the arduino as 2 wires plus ground. See my above reply. I’m looking at Pins 8/10.

Hi Eugene,

This link does not work. Could there be a typo ?


(The i was missing)

1 Like

Not sure if anyone cares but here is the answer I was looking for:

Pins 8/10 are the primary UART and it looks like I can use either of these to address it:


Because I hate it when people ask a question in a forum and then either ghost it or only say “figured it out” after they figure it out. I’ll post a real answer here when I get it working.


Short answer: gpio support in Xojo sucks, don’t use it. To use CAN Bus in raspberry you need extra Hardware, easiest way for codding it is python.

  1. It is not you it is the marketing, Xojo support for the pi is more like compiling for a desktop linux, just in ARM, gpio real support is not a thing.

  2. Maybe, BUT the Xojo way of doing things makes this really difficult, because gpio libs use real multithreading, and that did not exists on Xojo.

  3. if you need serious gpio support (beyond some leds and switches), this is the best way with Xojo.

  4. I did this for some Wiegand interfaces, it can be used for others.

The Arduino can emulate most protocols because it is close to bare metal, but the Pi runing a OS cant really emulate most hardware protocols. To use the CAN bus you need Hardware to connect to it. You can buy the RS485 chips and make your own interface, or you can get a RS485 CAN HAT for the PI.

UART is RS-232, cant be used to work with the CAN bus. but you need it because the pi communicates to the CAN HAT using the UART

In fact, you use the UART to communicate to the CAN HAT

Not sure if this will work, and there is Example 20-3 in the book with uses (SPI communication) where the data baud rate is set, using a Analogue-to-Digital-Converter (ADC).

I have run into previous issues where a manufacturer creates their own custom driver and no-one else could re-create the communication protocol. Even open-source data is sometime’s difficult to get the communication just right. Using an oscilloscope can often help reverse-engineer the protocol.

The Can Bus Module that I have is serial on one end and can bus on the other. So I only need to get the serial connection working on pins 8/10 to send commands to that and it will send them out over the can bus. Having a time getting it to work but it’s probably something stupid.

This protocol is very simple. I have the documentation for it from the motor manufacturer and the github on the arduino library. So that part shouldn’t be an issue if I can get the rx/tx lights to start blinking.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.