Gambas --> Beaglebone Black

Post

Posted
Rating:
#1 (In Topic #185)
Avatar
Regular
Askjerry is in the usergroup ‘Regular’
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
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
jornmo is in the usergroup ‘Regular’
I suppose you could draw some hints from this?

GPIO GUI (in gambas) - Raspberry Pi Forums

Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
Askjerry is in the usergroup ‘Regular’
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
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
stevedee is in the usergroup ‘Regular’
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

echo 1 > /sys/class/gpio/gpio32/value
echo 0 > /sys/class/gpio/gpio32/value

Take a look at documents like:


Again, there may be better documents out there, my suggestions are just to get you started.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
stevedee is in the usergroup ‘Regular’
This may also be of some interest: BeagleBone Black GPIO Benchmark | Code and Life
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Regular
Askjerry is in the usergroup ‘Regular’
 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
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Regular
stevedee is in the usergroup ‘Regular’

Askjerry said

…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:-


You may also be interested in: RPi GPIO Code Samples - eLinux.org
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Guru
cogier is in the usergroup ‘Guru’
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.. :?

Attachment
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Regular
Askjerry is in the usergroup ‘Regular’
It took a few years… but I finally hit the point where I'm able to control GPIO from GAMBAS on the Raspberry Pi.
Gambas One - Gambas ONE

So I'm not the sharpest tool in the shed… I get there eventually…
Online now: No Back to the top

Post

Posted
Rating:
#10
Avatar
Regular
stevedee is in the usergroup ‘Regular’

Askjerry said

It took a few years… but I finally hit the point where I'm able to control GPIO from GAMBAS on the Raspberry Pi…

Its been on the back-burner for quite a while, but I guess your Pi is now cooked.

Glad to see you also have the electronics side of things well covered. I wasn't trying "…to teach granny how to suck eggs…" or whatever the Texan equivalent saying might be, its just that many softies have little or no understanding of hardware. 8-)
Online now: No Back to the top

Post

Posted
Rating:
#11
Guru
BruceSteers is in the usergroup ‘Guru’

Askjerry said

It took a few years… but I finally hit the point where I'm able to control GPIO from GAMBAS on the Raspberry Pi.
Gambas One - Gambas ONE

So I'm not the sharpest tool in the shed… I get there eventually…

I think your best option is to combine your questions in different groups/forums.
Some questions will be more specific to your board (like pin configs and stuff) people on a beaglebone forum will be able to easily help you in that respect.

Then how to implement that knowledge in gambas is where we may help more.

Well the others can , I know not the information you seek , i just know the best way to seek it :)
I've never even heard of a Beaglebone black.   Raspberry, Orange and banana Pi's I have (not as tasty as they sound)

Wishing well
Bruce
Online now: No Back to the top
1 guest and 0 members have just viewed this.