k8090

Hello I am not a programmer but the k8090 fascinates me and I would love to know it.
Thanks to your examples I managed to realize a perte of page that interests me.

SORRY MY ENGLISH:
Would like to know what are sub to be written in visual basic so you know if the inputs (manual operation) are on-off thanks

What version of Visual Basic?

hi, the verision is Microsoft Visual Basic 2008 Express Edition. I need to know how i can read the output from the K8090 end activate e Led on my sw to know if the input is on…
Thanx for yuor attention.

Did you download the Software package for K8090 yet? It contains everything you need to use the board in Visual Basic 2008 Express.

you’ve downloaded the software for the k8090 but I wanted to create a program for my esiggenze. I can control the relays man I do not know the sub to recognize inputs or manual oporezione buttons. can you help me thank you pel patience. :confused: :confused:

an example to explain my problem: This sub active relay through bottone3;
Private Sub Button3_Click (ByVal sender As system.object, ByVal e As system.EventArgs) Handles Button3.click
’ Switch relays on (&h16)
K8090. ToggleRelay ()
[color=#0000FF]End Sub [/color]
qualèla sub to receive inputs manual operation? Thanks again

Take a look at the second sample provided in the software package. It declares a K8090_CommandReceived event like this:

Private Sub K8090_CommandReceived(ByVal o As System.Object, _
    ByVal args As Velleman.Kits.CommandEventArgs) Handles K8090.CommandReceived

    ' Add the event to our list
    PacketList.Items.Add("Received event " + args.cmd.ToString())
End Sub

Change it to this:

Private Sub K8090_CommandReceived(ByVal o As System.Object, _
    ByVal args As Velleman.Kits.CommandEventArgs) Handles K8090.CommandReceived

    If args.cmd = Velleman.Kits.K8090Command.ButtonStatus Then

        ' We can examine args.param1 to know which buttons have
        ' been pressed. Each button is represented by a bit in args.param1,
        ' so we'll need to check which bits are set.
        '
        '           args.param1
        ' ---------------------------------
        ' | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
        ' ---------------------------------
        ' | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
        ' ---------------------------------
        '       ^
        '     button 7 was pressed
        '
        Dim i As Integer
        For i = 0 To 7
            If args.param1 And (1 << i) Then
                PacketList.Items.Add("button " + (i + 1).ToString() + " pressed")
            End If
        Next

    End If

End Sub

This is also explained in the Developer’s Guide that comes with the examples.

Thank you for the examples, and work great. I’ve also extended the example at all entrances. saw your collaboration I would improve my program displaying the input as a symbol example (checkbox) that indicates if the entrance and to 0 or 1 thank you all symbol. (as happens in the demo K8090) THANK YOU FOR COLLABORATION

Hello. I would like for the button 1 (input) at level 1, the color of label1 is red and programmatic or label1 is green. for the button 2 (input) at level 1, the color of label2 is red and programmatic or label is green. still thank you for your cooperation and I apologize for English. I await your reply. :cry: :neutral_face: :cry:

Create three labels named lblButton1, lblButton2 and lblButton3

If args.cmd = Velleman.Kits.K8090Command.ButtonStatus Then

    //
    // Buttons = &H1, &H2, &H4, &H8, &H10, &H20, &H40, &H80
    //
    // args.mask = current state of each button
    // args.param1 = button presses
    // args.param2 = button releases
    //

    If (args.mask And 1) = &H1 Then
        lblButton1.ForeColor = System.Drawing.Color.Green
    Else
        lblButton1.ForeColor = System.Drawing.Color.Red
    End If

End If

Even better would be to use arrays and a loop to iterate over each button and show its status.

the example you gave aquisisce bit 1 and bits 0 inputs. but if bit of ’ input 1 and only 1 bit of eil ’ input 2 goes to 1 reporting (label) changes of State I am servirebero inputs between them independent. thank you again for your patience :neutral_face:

I remember that I’m not a programmer and I couldn’t take the hint:
“Even better would be to use arrays and a loop to iterate over each button and show its status”.
If possible let me through an example.

I’ve read and reread this about four times and I just can’t figure out what you’re trying to say… i’m sorry :frowning:

Remember that each bit represents a button. Also, use any parameter that suits your needs:
args.mask bit 0-7: State of button 1…8. If the bit is set, the corresponding button is pressed.
args.param1 bit 0-7: Button 1…8 has been pressed
args.param2 bit 0-7: Button 1…8 has been released

You probably need args.mask since you want the current state of everything. You can find all this information in the Protocol Guide and the K8090 Visual Basic.NET Developer’s Guide.

oooooooookkkkkk thanks the example works fine. I need a help to a relay timed … I would like to know the sub to temporizar the status relay 1 for a time by pressing a button. Thanks a lot for your patience. :laughing: :laughing:

' First set all buttons to timed mode (Page 6 of the Protocol Guide)
SendCommand(K8090Command.SetButtonMode, &H00, &H00, &HFF);

' Set the timer delay to 3 seconds (Page 7 of the Protocol Guide)
SendCommand(K8090Command.SetRelayTimerDelay, &HFF, 0, 3);

Once you’ve sent this, pressing a button should activate the corresponding relay for 3 seconds