User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

GPIO GUI (in gambas)

Thu Jul 18, 2013 6:24 am

Wrote a GUI to control the GPIO (and I2C , SPI ) for testing.
Its written in gambas
https://github.com/CWRoos/GPIO
The executable is GPIO.gambas
https://github.com/CWRoos/GPIO/blob/master/GPIO.gambas
Click on Raw to download.
Needs to be run as root ;

Code: Select all

sudo ./GPIO.gambas
needs wiringpi to be installed

User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

Re: GPIO GUI (in gambas)

Sun Jul 21, 2013 1:07 pm

Image

Updated,
Some improvements and bugs fixes.
And some simple I2C and SPI programming script added

Looks like a logic analizer but its not really, timing is to unstable and a bit slow.
Just giving some idea of whats going on on the bus.

I2C programming script ;
OP xx - Open device number xx
RD - Read a byte
WR xx - Write byte hex xx
RR xx - Read a byte from register xx
RW xx yy - Write byte yy to register xx
RR xx W - Read a word from register xx
RW xx yy W - Write word yy to register xx
WT xxx - Wait xxx mS max 1S - to avoid hanging
PH x - Set GPIO pin x high
PL x - Set GPIO pin x low
WH x - Wait for GPIO pin x to go high (max wait 1S) \
WL x - Wait for GPIO pin x to go low (max wait 1S) - 1 Sec to avoid waiting forever

Image

SPI programming script ;
OP x xxx - Open device x in xxx kHz
RD - Read a byte
WR xx - Write byte xx
RS xxx - Read a string of length xxx
WS abcde - Write string
WT xxx - Wait xxx mS max 1S
PH x - Set GPIO pin x high
PL x - Set GPIO pin x low
WH x - Wait for GPIO pin x to go high (max wait 1S)
WL x - Wait for GPIO pin x to go low (max wait 1S)

Image

It does needs some testing if everything is working correct, I don t have an ISP device at the moment.
Waiting for my USBee to arrive, then I can do some serious testing.
Feedback and criticism is welcome ;)
Last edited by CWRoos on Tue Jul 23, 2013 1:56 pm, edited 1 time in total.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: GPIO GUI (in gambas)

Sun Jul 21, 2013 1:35 pm

Thank you. The screen shot is much more exciting and informative than the project announcement! I can see this could be a very useful program development or debugging aid.

And as a side-effect it is an introduction to another GUI development tool for the RPi - I hadn't heard of Gambas before.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

Re: GPIO GUI (in gambas)

Mon Jul 22, 2013 3:39 pm

A little update on the GUI
Created install packages.

Now there's also a command line util to run the scripts written and tested and saved in the GUI
(so you can use the scripts in your own program)

Image

https://github.com/CWRoos/GPIOscript/

User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

Re: GPIO GUI (in gambas)

Mon Jul 22, 2013 9:24 pm

DeeJay wrote: And as a side-effect it is an introduction to another GUI development tool for the RPi - I hadn't heard of Gambas before.
Gambas actually was the first one I found and got working, even I'm actually a C++ programmer.
Basic was a little struggle but I learned ;)

Now there is a mono hardfloat, monoDevelop is working as well now but it makes mono executables.

And of course there's lazarus, the pascal Delphi clone, and that one looks great, its some time ago I did pascal programming.. still if I had found it earlier I would have wrote this GPIOGUI in it..

well. Gambas is doing the job as well..

User avatar
joan
Posts: 13618
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO GUI (in gambas)

Mon Jul 22, 2013 9:47 pm

I get /usr/bin/env: gbr3: No such file or directory on soft float jessie and hard float raspbian (wheezy).

I'm installing gambas3 on raspbian to see if that makes a difference. gambas3 is broken in soft float jessie.

User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

Re: GPIO GUI (in gambas)

Tue Jul 23, 2013 11:45 am

joan wrote:I get /usr/bin/env: gbr3: No such file or directory on soft float jessie and hard float raspbian (wheezy).
Yes it seems it does need gambas runtime (gbr3)
That's why I made install packages in Gambas supposing that would work.
Hmm.. well I suppose I should test it on a fresh raspbian SD card.......
To be honest gambas is new for me to

User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

Re: GPIO GUI (in gambas)

Tue Jul 23, 2013 5:12 pm

OK, first of all get wiringpi if not yet ;

https://projects.drogon.net/raspberry-p ... d-install/

Then install Gambas as described here ;

http://www.raspberrypi.org/phpBB3/viewt ... 11#p142511

User avatar
CWRoos
Posts: 17
Joined: Thu Jul 18, 2013 4:43 am

Re: GPIO GUI (in gambas)

Sat Aug 10, 2013 7:05 pm

Done a lot of testing I2C seems to work for many devices ;

Image

Did some updates on the SPI.

Actually the scripts are a bit to high level, was actually my intention to write a GUI for wiringpi and got a little out of control.

The scripts should be low level with ACK and NAK, full adreses with read/write bit ect..

Thats behind wiringpi tho..

User avatar
SteveDee
Posts: 343
Joined: Thu Dec 29, 2011 2:18 pm
Location: Sunny Southern England
Contact: Website

Re: GPIO GUI (in gambas)

Sat Oct 19, 2013 11:27 am

CWRoos wrote:Wrote a GUI to control the GPIO (and I2C , SPI ) for testing.
Its written in gambas
https://github.com/CWRoos/GPIO...
Good work CWRoos!

In addition to RPi testing, the source/project is a good place to start for those wishing to build their own Gambas RPi application.

For some reason there is no .project file with the project, so I don't think Gambas will recognise & open this without one. I just added my own, something like this:-

Code: Select all

Title=GPIO
Startup=FMain
Version=0.0.1
VersionFile=1
Component=gb.image
Component=gb.gui
Component=gb.form
Packager=1
To load and run the project (as root), type in a terminal:-

Code: Select all

gksu gambas3

User avatar
Cancelor
Posts: 754
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: GPIO GUI (in gambas)

Sat Oct 19, 2013 12:05 pm

CWRoos wrote:Wrote a GUI to control the GPIO ....
This is seriously cool 8-) ... I do like a good GUI, it's my age. :roll:

Wish I knew of it a month ago. :idea:
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

transmissions4less
Posts: 1
Joined: Mon May 26, 2014 3:56 pm

Re: GPIO GUI (in gambas)

Mon May 26, 2014 6:06 pm

first of all thank you for you wonderful work, i have some issues as i can not open the project code with gambas3.5.1 even after adding the missing project file, also when i run sudo ./GPIO.gambas it will get 100% cpu use indefinitely. also looking to have a small application project developed with gambas3 and see u familiar enough with i2c and graphics. please get back to me .
regards
salim

rezedent12
Posts: 1
Joined: Wed Oct 19, 2016 11:06 am

Re: GPIO GUI (in gambas)

Wed Oct 19, 2016 11:18 am

I present to you my program. It can either display the status of GPIO, so they have to manage.
Sourses code https://yadi.sk/d/d-MbrM-wx8xn2
Debian package https://yadi.sk/d/d_wwRq0bx8xnS

https://yadi.sk/i/XbSio80Qx5BP8


Представляю вам свою программу. Она может показывать статус GPIO и управлять им.
Attachments
VirtualGPIO-0.0.3.tar.gz
Исходный код
(14.3 KiB) Downloaded 79 times

Return to “Automation, sensing and robotics”