Devmel Company

Beginner’s Tutorial

This tutorial leads you through the creation of a simple app that uses the Devmel SDK to toggle the LinkBus VTG led when code is launched.

Before You Begin
Open a communication Port

#include <communication/linkbus/IOPort.hpp>
#include <devices/SimpleIPError.hpp>
#include <stdlib.h>
#include <stdio.h>

int main() {
	uint8_t addrGw[4] = {5,135,191,25};
	uint8_t addrLocal[16] = {0xfe,0x80,0x90,0xde,0x6e,0xff,0xfe,0x00,0xaf,0x42};
	uint8_t password[16] = {'+','a','Y','N','5','g','$','A','Z','v','2','H','f','9','x','z'};

	DevmelSDK::communication::linkbus::IOPort common(addrLocal, sizeof(addrLocal));

	common.setPassword(password, sizeof(password));
	common.setGateway(addrGw, 33863);
	common.setTimeout(10000);

	try{
		if (common.open()){
			common.toggleVTG();
		}
	}catch (const DevmelSDK::devices::SimpleIPError &e){
		printf("Exception : %s\n", e.what());
	}
	common.close();
	return 0;
}

Displaying the Result

Finally, look at the LinkBus device and launch the program. At every launch the VTG led toggles.