feverish
Posts: 486
Joined: Wed Jun 27, 2012 2:29 pm

Example;Lazarus and GPIO

Wed Jan 23, 2013 2:23 pm

Can anyone please point to the .PAS file(s) of a Lazarus project actually working on Raspi using the GPIO? I have read several posts about wiringpi and how it MUST be run under /root but while trying to learn Linux I'm almost ashamed to admit I just can't get my head around wrapper files which then point to getting something sometimes unspecified from elsewhere and where to put them. The particular problems I have is in 'Uses . . . ' and where to put the entry in the .PAS file(s) and any 'includes' and where they must reside, plus any 'IFDEFs'.
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Example;Lazarus and GPIO

Wed Jan 23, 2013 6:20 pm

I have read several posts about wiringpi and how it MUST be run under /root
That should be 'run as root', it has to do with permissions, not with location. You just run it with 'sudo' on the command line, e.g.:

Code: Select all

sudo myprogram
The archive with the Lazarus / FPC wrapper (which I assume you're using) also contains an example program (raspberry.lpr)

Gr.
Dirk.

feverish
Posts: 486
Joined: Wed Jun 27, 2012 2:29 pm

Re: Example;Lazarus and GPIO

Wed Jan 23, 2013 8:19 pm

Sounds wonderful! I'd love to see the sample programme, but in this context, what archive? How and where can I get it, please?
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

feverish
Posts: 486
Joined: Wed Jun 27, 2012 2:29 pm

Re: Example;Lazarus and GPIO

Wed Jan 23, 2013 10:12 pm

Please accept my apologies for not more closely specifying what it is I am looking for. Having left the world of terminal applications a long time ago, I omitted to say I needed an interface with the GPIO with a Lazarus gui application I have already written except for the GPIO bit.. I propose to use my Raspi to control and monitor the performance of a heater driven through a solid-state relay. The visual display of temperature and time, temperature alarm display and settings, log files and buttons to control heater ON/OFF, logfile views are catered for. This to some extent echos an earlier Arduino project I wrote and used, which is one reason I found wiringpi an attractive idea.
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Example;Lazarus and GPIO

Thu Jan 24, 2013 8:38 am

It really does not make a difference whether you're using a GUI or a console application for GPIO programming.

What you're probably looking for is a library with visual elements for meters, buttons etc. This has nothing to do with GPIO programming.
I know there are some libraries available, but I cannot find any ATM. You'll have to search the web for that, unless somebody else has a suggestion.

Gr.
Dirk.

feverish
Posts: 486
Joined: Wed Jun 27, 2012 2:29 pm

Re: Example;Lazarus and GPIO

Thu Jan 24, 2013 2:44 pm

Thanks. I have already written the application, using Lazarus, except for the small GPIO bit, and will use the buttons etc provided by Lazarus. I think I may have stumbled upon a way to use wiringpi.c If I have, I'll upload details to the projects forum. Meantime, thanks to all who offered help.
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Example;Lazarus and GPIO

Thu Jan 24, 2013 4:40 pm

feverish wrote:Thanks. I have already written the application, using Lazarus, except for the small GPIO bit, and will use the buttons etc provided by Lazarus. I think I may have stumbled upon a way to use wiringpi.c If I have, I'll upload details to the projects forum. Meantime, thanks to all who offered help.
You can always write it in C to use wiringPi ;-)

Maybe counter productive if you want to use Pascal though!

There's always BASIC too (RTB has wiringPi support...)

It's well over 25 years since I last looked at Pascal though...

-Gordon
--
Gordons projects: https://projects.drogon.net/

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Example;Lazarus and GPIO

Thu Jan 24, 2013 6:43 pm

feverish wrote:Thanks. I have already written the application, using Lazarus, except for the small GPIO bit, and will use the buttons etc provided by Lazarus. I think I may have stumbled upon a way to use wiringpi.c If I have, I'll upload details to the projects forum. Meantime, thanks to all who offered help.
I thought you were actually using the FPC wrapper for wiringpc...

If not, you can find a link on the Laz / FPC forum: http://www.lazarus.freepascal.org/index ... 404.0.html (I think you have to be registered on the forum to get access to the files)

Gr.
Dirk.

Return to “General programming discussion”