Raspberry PI GPIO Example

Another avenue to purchase the book is through the XojoLibrary at: http://xojolibrary.com/. If you are having problems purchasing the book, then you can contact Marc (the owner of the store):

support at xDevLibrary.com
(You’ll need to assemble that email address yourself as I haven’t made it clickable.)

I tried even that .
I think even that leads to the same Gumbooks… I even tried paypal which returned the same error. But that is excepted as the same card is linked with paypal. So i will be trying today and if the same issue persists will be calling the credit card provider for help.
Thanks for your help

If you send me a private message, I can send you Example 5-2 which is the ‘blink LED’ example. It just makes sure that everything is setup properly on your Raspberry Pi. :slight_smile:

Edit: If you download the Table of Content at: Program Raspberry Pi 4B Electronics with Xojo - Buster Edition, then it has Example 5-2 described.

sorry that is GUMROAD.

Appears that there is some issue. Same error while trying to make the purchase now.

Yes, send Marc an email at: support at xDevLibrary.com, he is really good at helping.

Ok will do that. But I suspect it is my card provider. A couple of months back my card was used by someone in Mexico to get Netflix account. I had raised an issue then. They blocked international transactions and then provided me with a new card. I strongly suspect this is the issue. I will contact them during the working hours today and try to get the book.
Thanks

Hi Julia
Thanks for your suggestions. I just completed the trial with timer as follows
a) Reverted back to the Older GPIO library (by Paul ?).
b) Removed thread and thereby the loop
c) Used a timer with 10ms time period
d) Read a single GPIO , update a Counter value and write to Sqlite
The overall CPU used : Maximum of 45%
I had to give up trying the pigpio library as I was not able to find proper documentation / examples for Xojo
Now I will try to read 4 GPIOs and write to 4GPIOS and test the same.
Next I will try the Worker App way
Thanks once again.
NOTE: it would have been nice to have some sort of file upload feature on this forum so that there could be improvements and a base for others to pickup

1 Like

Hi
I have tried the Worker Class. The CPU overload seems to really drop or I am not sure if I am checking it right.
When I used the Timer the CPU usage was around 25 - 45 %
But when i used the Worker class it came down to 3%
The Worker class is working. I have used a loop in the worker class. i used debug breakpoints. I am able to see the input read value change from 0 to 1 and vice versa based on my changing the physical button state. The count value is also increasing for each time the input goes high.

I am now stuck at 1 issue , i have to pass the count value and the input state to the main window. I have tried the “WorkerReadGPI0.SendProgress” and the JobProgressed without any result.
I am trying to update a control on the Mainwindow from JobProgressed. i am using the SendProgress to send the count a string (Count.ToString)
I am not able to get much info on how to use these in the Xojo Documentation

Thanks

this Worker class can only communicate via string.
suggested was json string via JSONItem.
Worker is somehow a endless loop where each request return a value in your case.
are you sure that is better and really without cpu usage?

how i think it is working

Start <- Once
JobRequested -> JobRun + SendProgress 
JobCompleted 
JobProgressed <- for UI Updates
Stop

xojo came with 2 examples of this worker class.

Hi MarkusR
Thanks for your reply
Yes I got the Flow Sequence.
I used teh SendProgress in JobRun, then I tried updating the UI from the JobProgressed Event. That does not work (probably by design). I thought this might work based on the UI update happening on the JobRequested. But now I think that The Job Run is spawned in a separate Core or thread (in debug mode)

Whatever, I used the JobProgressed Event to update a variable in MainWindow. Then in MainWindow used a Timer to update the UI. This is working
Now I am trying to build / compile the program to send to raspberry Pi. Because the Worker class runs as thread in the debug mode and it uses 100% CPU . I want to try to run as a compiled app which might show the actual CPU usage.
But again, I am stuck here. I am using a Xojo Free License for RPi. I am not sure if this version allows compile. So relying on my friend "google " to find info on this
Overall, going through the hurdles …

i think Worker is part of Desktop License … No License = No Build.
you could also test my mentioned idea with std in/out from shell with help of a Python script.
Python IDE for a test is preinstalled at pi.

Yes, will start on that. But I am not really that strong on Python, though I did develop a couple of projects. Nothing related to GPIO
But I will definitely try and update here.