Thread overview
Using D for Raspberry Pi expirements
Sep 25, 2019
aberba
Sep 26, 2019
Mike Franklin
Sep 29, 2019
aberba
Sep 29, 2019
Mike Franklin
Sep 29, 2019
Aldo
Sep 29, 2019
aberba
Sep 26, 2019
aberba
Sep 26, 2019
Dave Chapman
Sep 29, 2019
aberba
Oct 02, 2019
Dave Chapman
September 25, 2019
I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python.

Anyone here tried something like that using D?
September 26, 2019
On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote:
> I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python.
>
> Anyone here tried something like that using D?

I haven't tried with D yet, but I use C# and mono calling into the pigpio C library (http://abyz.me.uk/rpi/pigpio/pdif2.html) and it workes great.  You should be able to do the same with D.

Mike
September 26, 2019
On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote:
> I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python.

Just found this package dating back from May 2016...let's see what it can do (https://github.com/fgheorghe/D-Lang-Raspbian-GPIO-Module)

>
> Anyone here tried something like that using D?


September 26, 2019
On Thursday, 26 September 2019 at 00:10:40 UTC, aberba wrote:
> On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote:
>> I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python.
>
> Just found this package dating back from May 2016...let's see what it can do (https://github.com/fgheorghe/D-Lang-Raspbian-GPIO-Module)
>
>>
>> Anyone here tried something like that using D?

I've been using https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/ . It is a C library written by Bartosz Golaszewski. He is actively working on it. The latest update is a week old. It has the advantage that you don't have to use sudo to access the gpio pins. It comes with a set of tools written in C that I have been converting to D. Since my knowledge of both D and C is weak it has taken me some time to get things going. I have a hand written D bindings file that is incomplete and of amateur quality. So far I have converted 2 of the 6 command line tools that Bartosz Golaszewski provided to to work with the library.

David Chapman
September 29, 2019
On Thursday, 26 September 2019 at 17:26:25 UTC, Dave Chapman wrote:
> On Thursday, 26 September 2019 at 00:10:40 UTC, aberba wrote:
>>> [...]
>
> I've been using https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/ . It is a C library written by Bartosz Golaszewski. He is actively working on it. The latest update is a week old. It has the advantage that you don't have to use sudo to access the gpio pins. It comes with a set of tools written in C that I have been converting to D. Since my knowledge of both D and C is weak it has taken me some time to get things going. I have a hand written D bindings file that is incomplete and of amateur quality. So far I have converted 2 of the 6 command line tools that Bartosz Golaszewski provided to to work with the library.
>
> David Chapman

your code... can you push it to GitHub so I can check it out?
September 29, 2019
On Thursday, 26 September 2019 at 00:09:30 UTC, Mike Franklin wrote:
> On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote:
>> I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python.
>>
>> Anyone here tried something like that using D?
>
> I haven't tried with D yet, but I use C# and mono calling into the pigpio C library (http://abyz.me.uk/rpi/pigpio/pdif2.html) and it workes great.  You should be able to do the same with D.
>
> Mike

I have no idea how to do that from D. Any help/resources on that?
September 29, 2019
On Sunday, 29 September 2019 at 11:36:00 UTC, aberba wrote:

> I have no idea how to do that from D. Any help/resources on that?

You should be able to use the techniques at https://dlang.org/spec/interfaceToC.html to declare the C functions that you wish to use in your *.d source files, and then, when you compile, pass `-lpigpiod_if2` to the linker.

Mike
September 29, 2019
On Sunday, 29 September 2019 at 11:36:00 UTC, aberba wrote:
> On Thursday, 26 September 2019 at 00:09:30 UTC, Mike Franklin wrote:
>> On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote:
>>> I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python.
>>>
>>> Anyone here tried something like that using D?
>>
>> I haven't tried with D yet, but I use C# and mono calling into the pigpio C library (http://abyz.me.uk/rpi/pigpio/pdif2.html) and it workes great.  You should be able to do the same with D.
>>
>> Mike
>
> I have no idea how to do that from D. Any help/resources on that?

Maybe you can use this dub package? http://code.dlang.org/packages/dgpio

I'm using a D app on a raspberry Pi to open my house portal for 1 year now. It works perfectly. The "hardest" part is the compilation.

I tried this guide yesterday: https://wiki.dlang.org/Programming_in_D_tutorial_on_Embedded_Linux_ARM_devices and it worked perfectly fine. I compiled my app from Windows with a Debian (from the windows store) and uploaded my executable compiled with ARM target.


September 29, 2019
On Sunday, 29 September 2019 at 16:26:48 UTC, Aldo wrote:
> On Sunday, 29 September 2019 at 11:36:00 UTC, aberba wrote:
>> On Thursday, 26 September 2019 at 00:09:30 UTC, Mike Franklin wrote:
>>> [...]
>>
>> I have no idea how to do that from D. Any help/resources on that?
>
> Maybe you can use this dub package? http://code.dlang.org/packages/dgpio
>
> I'm using a D app on a raspberry Pi to open my house portal for 1 year now. It works perfectly. The "hardest" part is the compilation.
>
> I tried this guide yesterday: https://wiki.dlang.org/Programming_in_D_tutorial_on_Embedded_Linux_ARM_devices and it worked perfectly fine. I compiled my app from Windows with a Debian (from the windows store) and uploaded my executable compiled with ARM target.

Thanks. Appreciate.
October 02, 2019
On Sunday, 29 September 2019 at 11:26:41 UTC, aberba wrote:
> On Thursday, 26 September 2019 at 17:26:25 UTC, Dave Chapman wrote:
>> [...]
>
> your code... can you push it to GitHub so I can check it out?

I haven't used GitHub or git. Is there some other way?