Write a simple INPUT & OUTPUT program for KMK USB 13IO Card with Microsoft Visual Basic 2008 Express.
We are going to write a program to control the leds according to the input status of the tact switches. Please refer to KMK USB 13IO Card manual for detail operations.
Step 1 - 2 need to do once on your computer. Just skip steps 1 - 2 if you have done it already, .
Step 1 Install Visual Basic 2008 Express (VB).
Step 2 USB Driver installation.
Step 3 Install KMK USB 5I8O OCX for KMK USB 13IO card.
Step 4 Load KMK USB 5I8O OCX into VB.
Step 5
Make sure you have attached the IO card to the PC and the OCX is on the form. Then you should see the serial number of the card on the status window as below;
Step 6
We are going to write the code for automatically connecting the IO card while the program is started. Double click on the empty space of the form to enter into the code page. Type the code as below;
Step 7
Since we are going to operate the leds according to the input signal, we first put a Timer to scan the status of the tact switches. Then change the property Enabled to true.
Step 8
Enter the code below and we can finish the input and output code easily.
Step 9
Now Run the program by clicking 'Start Debugging' button on the tool bar or press F5 and observe Leds while pressing the tact switches of the IO card.
Note: You can connect DC 6V~9V devices to the board such as DC motors, light bulbs etc. and connect Push buttons, Magnetic switches,etc to the IO card. Remember to apply external DC 6V-9V power to it.