bindings-K8055: Bindings to Velleman K8055 dll

[ bsd3, ffi, library ] [ Propose Tags ]

Bindings to Velleman K8055 dll for interfacing USB I/O board.


[Skip to Readme]

Modules

[Last Documentation]

  • Bindings
    • Bindings.K8055
      • Bindings.K8055.AnalogIn
      • Bindings.K8055.AnalogOut
      • Bindings.K8055.Counters
      • Bindings.K8055.DigitalIn
      • Bindings.K8055.DigitalOut

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.1.2
Dependencies base (>=3 && <5) [details]
License BSD-3-Clause
Author Joris Putcuyps
Maintainer Joris.Putcuyps@gmail.com
Category FFI
Home page https://github.com/jputcu/bindings-K8055
Bug tracker https://github.com/jputcu/bindings-K8055/issues
Uploaded by JorisPutcuyps at 2011-05-17T17:09:33Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2811 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-10-27 [all 11 reports]

Readme for bindings-K8055-0.1.2

[back to package description]

Description

This library allows you to control the Velleman K8055, a usb experiment interface board.

The board has:

  • 5 digital inputs
  • 2 analog inputs
  • 8 digital outputs
  • 2 analog outputs

How is works

Velleman provides a K8055D.dll, so this is a Windows-only solution, to interact with the board. A FFI interface has been written to interact with the dll functions. For this I had to create a definition file K8055D.def and run dlltool -k -d K8055D.def -l K8055D.dll.a.

Some Background

My first attempt at interfacing this board was using bindings-libusb. After getting is to work on Linux I was unable to compile it on Windows. Because my solution should work on Windows I chose to interface the existing dll.

I haven't given up on the my first solution, it's still the cleanest way to go, having no K8055 specific, native library dependencies and being platform-independent.

Install

As mentioned earlier, we need the K8055D.dll. This can be obtained by downloading the official Velleman K8055 SDK. Extract it and put the dll, DLL_v4.0.0.0/K8055D.dll, somewhere in PATH, e.g. C:\Windows\System32.

Then all you need to do is install the cabal package:

cabal install Bindings-K8055

Example

Press a button, digital in, an run the following code:

import Bindings.K8055

main :: IO ()
main =
  withDevice Card1 (readAllDigital >>= print)

Or using ghci:

> import Bindings.K8055
> withDevice Card1 (readAllDigital >>= print)
0