Giter Club home page Giter Club logo

bindings-k8055's Introduction

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 libK8055D.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, and try the following ghci code:

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

Or compiled. Watch out, you need the libK8055D.a interface library, which was packaged in this cabal package and was probably installed in %APPDATA%\cabal\bindings-K8055-0.1.2. By putting it in the subdirectory ghc-<version> it should be found by the compiler.

import Bindings.K8055

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

bindings-k8055's People

Contributors

jputcu avatar

Watchers

 avatar James Cloos avatar

bindings-k8055's Issues

Missing C library: K8055D

Cabal is unable to install the bindings-k8055 haskell library due to a missing K8055D C-library.

Although the C-library is present in the distribution and the cabal configuration file contains extra-lib-dirs:., cabal complains.

A workaround is to extract the cabal package and cabal configure/build/install with the --extra-lib-dirs=. option.
And apparently it also requires the K8055D.dll in the same directory!

Linux support

You mentioned you didn't give up supporting Linux via libusb bindings. I also did some tests with libusb and K8055.
Did you publish your Linux solution or are you interested in making this package support Win and Linux via k8055 library on win and libusb on linux with the same interface?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.