Results 1 to 6 of 6

Thread: 4 button switchboard

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    3

    4 button switchboard

    Hello

    I need some help in modifying my Visual Basic 5 code
    I have a USBmicro interface board connected to the PC I have 4 switchs on 4 seperate ports
    so when I press the read0 command button and hold down one of 4 momentary switchs the backcolor changes from &HFF to &H80

    The following is the current sequence

    1. Run program in windows
    2. Push switch in on the u401 and hold, Click read0 command button in the form1 code.
    3. backcolor changes from &HFF to &H80
    4. release switch click read0 command button
    backcolor goes back to &HFF

    The sequence I would like is

    1. Run program in windows
    2. push switch in momentary
    3. color changes from &HFF to &H80
    4. release switch backcolor goes back to &HFF

    The following code lies in my form1 (demotest.frm) which also has the following module files so as to acces the U401.

    osinterface.bas
    hidinterface.bas
    miscfunc.bas
    USBmAPI.bas

    The code that needs to be modifided is as follows


    Private Sub Read0_Click()

    USBm_ReadA 0, State0

    Write0Value.Text = TwoHexCharacters$(State0)

    If State0 And &H1 Then D0.BackColor = &HFF Else D0.BackColor = &H80
    If State0 And &H2 Then D1.BackColor = &HFF Else D1.BackColor = &H80
    If State0 And &H4 Then D2.BackColor = &HFF Else D2.BackColor = &H80
    If State0 And &H8 Then D3.BackColor = &HFF Else D3.BackColor = &H80

    If you require more technial help please go to http://www.usbmicro.com


    Thank you hope to hear from someone soon.
    Last edited by Sally6; Apr 26th, 2005 at 02:48 AM. Reason: url not working

  2. #2
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: 4 button switchboard

    I'm not sure what some of the controls are that you mentioned.

    If you have a command button and set it's style to Graphical, then this code will work-
    VB Code:
    1. Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.   Command1.BackColor = &H80
    3. End Sub
    4.  
    5. Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    6.   Command1.BackColor = &HFF
    7. End Sub
    Rob C

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    3

    Re: 4 button switchboard

    Thanks Rob but that is for a mouse command if you go to the URL I have posted on the bottom of the thread it will give you an idea of what I want

    Thanks Sally6

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: 4 button switchboard

    Something like this?

    http://www.usbmicro.com/odn/index.html App 1 - Output

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: 4 button switchboard

    If I understand you correctly, you are in need of an event, that fires whenever an action is performed on the device.

    If the dll you use doesn't provide you with any event like features, the only thing I can think about is to periodically poll for changes.
    You could use a timer for this.
    Frans

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    3

    Re: external switch device

    Thanks Frans C Your first paragraph is correct I need an event to happen when I depress the external switch. my knowledge of visual basic is limited to manipulating the code for the USB micro interface board, click the run button and hope for the best. I know its possible to do I just need someone who is familiar with software hardware.

    Thanks
    Sally6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width