Gambas --> Beaglebone Black

Post Reply
Askjerry
Posts: 4
Joined: Saturday 18th August 2018 9:06pm

Gambas --> Beaglebone Black

Post by Askjerry » Saturday 18th August 2018 9:12pm

I just installed Linux and Gambas 3 onto my Beaglebone Black... I have decades of experience with Vidual BASIC... so it didn't take much to make a simple program, run it, compile it and make it installable...

But now... how do I access the Beaglebone GPIO to both read the status of a pin and/or set the status of a pin??

It would be great if someone could send me some code that turns an LED plugged into a pin on/off using a button on the screen. And a display on the screen that changes state depending on the condition of a beaglebone pin. (High/Low)

Can anyone help??? :shock:
Thanks,
Jerry

User avatar
jornmo
Site Admin
Posts: 173
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Gambas --> Beaglebone Black

Post by jornmo » Thursday 23rd August 2018 3:28pm

I suppose you could draw some hints from this?

https://www.raspberrypi.org/forums/view ... hp?t=50246

Askjerry
Posts: 4
Joined: Saturday 18th August 2018 9:06pm

Re: Gambas --> Beaglebone Black

Post by Askjerry » Saturday 08th September 2018 1:05am

Not really... it was written for the Raspberry Pi, and I have a Beaglebone. The pin configuration is different. Also, I downloaded the files from that page and attempted to open them in Gambas but was unable to do so.

Is there a Beaglebone library? Do I need to abandon the Beaglebone and use the Raspberry Pi instead?

Does ANYONE have a sample code that will allow me to connect an LED to a BEAGLEBONE GPIO pin, click a button, and toggle the LED? If I could get that far... it would be a tremendous start.

Thanks,
Jerry

stevedee
Posts: 89
Joined: Monday 20th March 2017 6:06pm

Re: Gambas --> Beaglebone Black

Post by stevedee » Sunday 09th September 2018 6:09pm

From the link provided by Jornmo you can see that a similar library is probably the best approach for using Gambas with the Beaglebone. You will also need to understand how such a library can be used with Gambas.

I don't have a Beaglebone Black, so I can only suggest that you have a couple of programming options;
1) you could find a suitable C/C++ Library and use this to access GPIO via your Gambas code.
2) you could try to work with the I/O files to read and write to the pins.

A quick search of Github brought up this C++ Library: https://github.com/yigityuce/BlackLib
It looks suitable, but as I say I've never used it.

Using simple file commands involves configuring & exporting pins, and then executing commands from Gambas. So to toggle a pin may involve something like:-

Code: Select all

echo 1 > /sys/class/gpio/gpio32/value
echo 0 > /sys/class/gpio/gpio32/value
Take a look at documents like: https://elinux.org/images/3/33/GPIO_Pro ... lebone.pdf

Again, there may be better documents out there, my suggestions are just to get you started.

stevedee
Posts: 89
Joined: Monday 20th March 2017 6:06pm

Re: Gambas --> Beaglebone Black

Post by stevedee » Sunday 09th September 2018 6:18pm


Askjerry
Posts: 4
Joined: Saturday 18th August 2018 9:06pm

Re: Gambas --> Beaglebone Black

Post by Askjerry » Friday 23rd November 2018 9:11pm

Everything seems to point to Python.

I have a Raspberry Pi now... and I used GLADE to create a panel... then got an LED to turn on/off with a button. So I accomplished that goal. Likely could do the same with the Beaglebone Black as well.

It's a shame... I would have liked to use Gambas... it is a more familiar interface... and I can make it look more closely like I want with the for tool.

If anyone ever does get a working GPIO with GAMBAS in either Beaglebone or Raspberry Pi... leave a post here... I'd be interested in seeing what you have... and trying your code.

Thanks,
Jerry

stevedee
Posts: 89
Joined: Monday 20th March 2017 6:06pm

Re: Gambas --> Beaglebone Black

Post by stevedee » Saturday 24th November 2018 7:37pm

Askjerry wrote:
Friday 23rd November 2018 9:11pm
...I have a Raspberry Pi now... If anyone ever does get a working GPIO with GAMBAS in either Beaglebone or Raspberry Pi... leave a post here...
Programming with Gambas on the Raspberry Pi utilising the GPIO is not a problem. You could use one of these two libraries:-
- wiringPi; see my blog post https://captainbodgit.blogspot.com/2013 ... ambas.html
- pigpio; see my blog post https://captainbodgit.blogspot.com/2016 ... brary.html


You may also be interested in: https://elinux.org/RPi_GPIO_Code_Samples

User avatar
cogier
Site Admin
Posts: 198
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Gambas --> Beaglebone Black

Post by cogier » Sunday 25th November 2018 5:04pm

I had forgotten about the attached Gambas program I wrote in 2016. It can control the Pi pins. It only requires that 'gpio' is installed on the Pi which I understand is a default installation. There is a module you can add to your program that will give you control.

There are some pictures of the program running here http://www.cogier.com/stevedee/ that I put up for stevedee some time in another life.. :?
GPIO.tar.gz
(51.31 KiB) Downloaded 2 times

Post Reply