I'm trying to control a motor via a device called a Motor-Bee, and using C++.
This is the code I'm using :
#include <iostream.h>
#include <mt.h>
#include <windows.h>
#pragma hdrstop
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE HStpDll; // declaration of variable to hold the handle to the dll
HStpDll = LoadLibrary( _T("mtb.dll")); // load the dll into memory and return handle
Type_InitMotoBee InitMotoBee;
Type_SetMotors SetMotors;
InitMotoBee = (Type_InitMotoBee)GetProcAddress( HStpDll, " InitMotoBee");
SetMotors =(Type_SetMotors)GetProcAddress(HStpDll, " SetMotors");
InitMotoBee();
SetMotors(0, 50, 0, 0, 0, 0, 0, 0, 0);
return 0;
}
mt.h and mtb.dll are files which come with the device.
When I try to run the program, all I get is a box pop up saying:
"Project2.exe raised exception classEAccessViolation with message 'Access violation at address 00000000. Read of address 00000000'. Process stopped. Use step or Run to continue."
A PDF manual with info about C++ functions can be found here.
Could anyone tell me what I'm doing wrong? Or, course how to solve it if possible.