The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Device::Velleman::K8055 - Communication with the Velleman K8055 USB experiment board

VERSION

Version 0.01

SYNOPSIS

Currently this module is just a Win32::API wrapper around the DLL that Velleman supplies with the board. Since that will only work on Win32 systems, I intend to write something myself that will be portable to other platforms...patches for this are welcome.

    use Device::Velleman::K8055 qw(:all);

    die "Can't open K8055 device" unless OpenDevice(0) == 0;
    
    for (my $i = 0; $i < 3; $i++)
    {
        for (my $j = 1; $j < 3; $j++)
        {
            SetAnalogChannel($j);
            ClearAnalogChannel($j == 1 ? 2 : ($j -1));
            sleep(1);
        }
    }
    ClearAllAnalog();
    CloseDevice();

USAGE

OpenDevice($devicenumber);

This opens the device, indicated by $devicenumber, which can be any value ranging from 0 to 3. The devicenumber is determined by the jumpers you set on the board. The default setting is 0.

It returns -1 if it's unsuccessful, the devicenumber that has been opened in case of success.

CloseDevice();

This closes the device. You don't need to call CloseDevice between switching of the different devicenumbers. Just call it at the end of your application.

$value = ReadAnalogChannel($channel);

This reads the value from the analog channel indicated by $channel.

ReadAllAnalog($data1, $data2);

This reads the values from the two analog ports into $data1 and $data2.

OutputAnalogChannel($channel, $data);

This outputs $data to the analog channel indicated by $channel.

OutputAllAnalog($data1, $data2);

This outputs $data1 to the first analog channel, and $data2 to the second analog channel.

ClearAnalogChannel($channel);

This clears the analog channel indicated by $channel

ClearAllAnalog();

This clears all analog channels.

SetAnalogChannel($channel);

This sets analog channel $channel.

SetAllAnalog();

This sets all analog channels.

WriteAllDigital($data);

ClearDigitalChannel($channel);

ClearAllDigital();

SetDigitalChannel($channel);

SetAllDigital();

$value = ReadDigitalChannel($channel);

$value = ReadAllDigital();

$value = ReadCounter($counternumber);

$value = ResetCounter($counternumber);

SetCounterDebounceTime($counternumber, $debouncetime);

AUTHOR

Jouke, <jouke@pvoice.org>

BUGS

Please report any bugs or feature requests to bug-device-velleman-k8055@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Device-Velleman-K8055. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Thanks to Yaakov and Hachi from #perl on irc.perl.org for the idea that eventually lead to buying the K8055 USB experiment board.

COPYRIGHT & LICENSE

Copyright 2005 Jouke, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.