# Visual Basic 10 For I/O Board



## syker (Jun 23, 2010)

How do i get the input 1 and input 2 buttons to CONTROL the LED lights?


----------



## Easy Rhino (Jun 23, 2010)

your would be better served if you asked your question in the context of what you are trying to do. also, provide some sort of code you have already written so that people know where to start to help if they can.


----------



## syker (Jun 23, 2010)

Easy Rhino said:


> your would be better served if you asked your question in the context of what you are trying to do. also, provide some sort of code you have already written so that people know where to start to help if they can.



i want to be able to control individual lights on a timer, with button-control. that is probably as specific as i can get so far. we are working on a class project, but we are completely stuck, otherwise.

here is the code so far:

Public Class VB_Digital_IO
    Private Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Integer) As Integer
    Private Declare Sub CloseDevice Lib "k8055d.dll" ()
    Private Declare Function ReadAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer) As Integer
    ' Note the following was changed to return ByRef instead of ByVal to allow proper usage
    Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (ByRef Data1 As Integer, ByRef Data2 As Integer)
    Private Declare Sub OutputAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer, ByVal Data As Integer)
    Private Declare Sub OutputAllAnalog Lib "k8055d.dll" (ByVal Data1 As Integer, ByVal Data2 As Integer)
    Private Declare Sub ClearAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer)
    Private Declare Sub SetAllAnalog Lib "k8055d.dll" ()
    Private Declare Sub ClearAllAnalog Lib "k8055d.dll" ()
    Private Declare Sub SetAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer)
    Private Declare Sub WriteAllDigital Lib "k8055d.dll" (ByVal Data As Integer)
    Private Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer)
    Private Declare Sub ClearAllDigital Lib "k8055d.dll" ()
    Private Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer)
    Private Declare Sub SetAllDigital Lib "k8055d.dll" ()
    Private Declare Function ReadDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer) As Boolean
    Private Declare Function ReadAllDigital Lib "k8055d.dll" () As Integer
    Private Declare Function ReadCounter Lib "k8055d.dll" (ByVal CounterNr As Long) As Integer
    Private Declare Sub ResetCounter Lib "k8055d.dll" (ByVal CounterNr As Integer)
    Private Declare Sub SetCounterDebounceTime Lib "k8055d.dll" (ByVal CounterNr As Integer, ByVal DebounceTime As Integer)

    Private Sub VB_Digital_IO_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim CardAddress As Integer
        Dim h As Integer
        CardAddress = 0
        h = OpenDevice(CardAddress)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SetAllDigital()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ClearAllDigital()
    End Sub
End Class


----------



## syker (Jun 23, 2010)

anyone up for the task?


----------



## FordGT90Concept (Jun 23, 2010)

What LED lights?  How are they connected to the computer?  Also, what is this k8055d.dll you reference a lot in your code?


----------



## syker (Jun 23, 2010)

K8055 I/O board, USB-connected


----------



## Kreij (Jun 23, 2010)

Are these discrete LEDs or something like a 7-segment display?

Can't you hook the individual LEDs up to the digital channels on the controller and use the WriteAllDigital(number) method to turn on the channels that you want lit?


----------



## syker (Jun 23, 2010)

Kreij said:


> Are these discrete LEDs or something like a 7-segment display



seven-segment display. theyre all connected to a board.


----------



## Kreij (Jun 23, 2010)

Sorry .. alittle busy today 

So you are trying to control one 7-seg display from the K8055 board?
Something like a count-down timer?


----------



## FordGT90Concept (Jun 23, 2010)

All I know is you'll probably need to use the SerialPort class.

This might help make communicating with the device easier: http://www.icsharpcode.net/opensource/sharpusblib/


----------

