Formula AllCode and Visual Studio

Another common programming tool is Visual Studio from Microsoft. In this blog we explore various methods to communicate to the Formula AllCode using some of the more widely known programming languages such as C++, C# and VB. Please note that I am no expert on any of these languages, all I have done is put together simple examples that work.

I used the free version of Visual Studio 2015 which comes with C# and VB working out the box. C++ is an optional extra so this had to be downloaded and installed separately.

 

C#

Here we have an example to open the COM port, play a few notes and close the COM port again using C# and the FASlave DLL. The DLL file then simply needs to be copied into the same folder as the .exe file.

To begin we click File -> New -> Project

Then from Templates select Visual C# and Console Application.

Here is the C# code we used to communicate with the Formula AllCode API.

C#Example

 

Visual Basic

Another commonly used language that comes with Visual Studio is Visual Basic.

Here is the same program written using VB. Again the FASlave.dll file needs to be copied into the same folder as the .exe for the example to work.

To begin we again click File -> New -> Project

Then from Templates select Visual Basic and Console Application.

Here is the VB code we used to communicate with the Formula AllCode API.

VBExample-2

 

C++

For a long time C++ was the programming language to go for when developing applications, this has now been superseded by languages like C# and Java but it still has it’s uses. The good thing about C++ is it’s familiarity with C so anyone that can use C can also use C++ with a fairly shallow learning curve. The Arduino language for example is a rather strange mix of C and C++.

To begin we again click File -> New -> Project

Then from Templates select Visual C++ and Win32 Console Application.

We include the DLL calls by clicking Project -> Add existing File and adding the FASlave.lib file.

Here is the Visual C++ code we used to communicate with the Formula AllCode API.

C++Example

The code for these various examples can be downloaded here.

Slave AllCode Examples

 

26,700 total views, 10 views today

2 Comments

Leave a Reply