Desktop App to Control Movement of Robot

Hello,

I am currently trying to build a desktop app that is connected to a raspberry pi in order to move a robot when a button is pressed. I am currently having trouble understanding the GPIO pins and how to use them using the xojo language. I do have the motors working using python however. Thus, I wanted to see if there was a way that when I press the button on Xojo I can use the GPIO pins to move the DC motors. Or since I already have the code in python is there a way I can use that code on Xojo? PLEASE HELP This a project that needs to be done REALLY SOON! Thank you!

I was able to learn from this project.

Do the tutorials they link work? Like the link to access them? Because it doesn’t with me.

I can see that they use servo motors. But, I am confused because they don’t do it when the button is pressed. Right now I am having problems, that when the button is pressed it stays pressed and I don’t see it doing anything else. I can’t press any other button either.

Using the GPIO is more like a hack than a feature, I would not recomend to use it like this.

Yes, this is the bes option, you can do a good interface with xojo and send commands to the python code. This can be done with sockets for example.

Sorry, I am really new xojo! How would this work? Can I have like a tutorial?

You are right, those links don’t work. These do.

If i test the code through the debugger, instead of building the app would it still function and move the servo motors? Also, with this code, if I put it on a button. It should work when the action is " pressed " correct?

Because I do know I tested this code, but I’m not sure if it can be properly tested if I do it through the debugger.

It should work when remote debugging on the raspberry pi.

1 Like

I thought I would add a picture of what I am trying to do to. Also, I dont know if i understand how to properly translate the python code to xojo language.
Screenshot 2022-11-04 230614

for the desktop app i would use tcp connection.
tcp network can be used with python.
and you can enable/install access to gpio via tcp at your pi too.

tcp is very simple. one device listen at a given port. the other connect.
after connection you can read/write data bidirectional.

1 Like

Strongly, strongly, recommend that you purchase this book if trying to work with electronics and Xojo.

https://scispec.ca/index.php/books/54-program-raspberry-pi-4b-electronics-with-xojo-buster-edition

You need to use PiGPIO now as wiringPI is no longer maintained.

2 Likes

it is no longer maintained? WHATT all xojo forums tell you to get wiringpi if you are going to work with GPIOs i-

Afraid so.

The nature of the Internet and technology mean many resources go out of date.

https://hackaday.com/2019/09/18/wiringpi-library-to-be-deprecated/

Hello Karla, for such things im living in the world of AutoSar, Vector , Mathlab. and many more on the globe,

I suggest to have the low level logic in a python app, where u get all the libs and then have a consumer ( lets call it Xojo app) for the interaction working with standards like sockets, streams on a very simple protocoll ( Telegrams).

Benefit No1 : you can test and debug them independently: which makes your life much easier.
Benefit No2 : you have the libs interfaces, which are deployed / maintained with the devices.
Btw : it’s also possible to separate it physically by adding a arduino to the pi ( like a subsystem )

BR Rainer

Node-RED is maybe useful for u, it have a ui designer and a web frontend.
it is installed at pi. can be accessed by browser at phone,tablet,desktop pc.
u need java-script knowlegde for this.

I decided to get the book that helps you out with how to control the movement like i wanted but I am not having trouble understanding the code. I am currently getting this error.

Hello @karla_gonzalez ,

From the screen grabs, it appears that this is a Raspberry Pi 4b with PiGPIO. I don’t understand the error that Xojo is seeing, and if you go to page 29 of the book, there is a section called QuickStart that shows how to get Xojo and Raspberry Pi setup to run an LED blinking test. Could I ask that the QuickStart steps be tried first before starting to troubleshoot the program?

Warm regards :slight_smile:

The Sub / End Sub shouldn’t be in the code editor. Remove those lines and the error will go away.

1 Like