AWC Electronics - Using the GP3 with Visual Basic Express
Its easy to use the GP-3 with most versions of Visual Basic including the Express versions that Microsoft make available free of charge. Here's a visual guide.
- Create a new project. Here I've used gp3test as the name of the project.
- Add a COM reference to AWCGP3 (this assumes you've installed the library). This screen is accessed from the Project | Add Reference... menu.
- Add the GP3IO component to the tool box. To do this, open the toolbox and right click on a header like "All Windows Forms". The pick Choose Items.
- Drag a GP3 control from the tool box to your form. Although it will show on the form at design time, it will be invisible at run time.
- For this example, I put two buttons on the form. One button will eventually turn on the GP3's onboard LED and the other will turn it off.
- The GP3 control needs to have the correct COM port set. You might want to allow the user to pick the COM port, but for this simple example, I just hardwired it to COM 8 (a USB serial port on my computer). I also changed the name to GP3.
- Finally, you can write code to make the buttons work. For a real program you'd probably open the GP3 once in the form load and close it at the end of your program. Here, I just open and close it on each button push.