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
Constructing a SimpleIPConfig Object

import com.devmel.storage.SimpleIPConfig;
import com.devmel.tools.IPAddress;

public class LinkBusVTG {

	public static void main(String[] args) {
		
		//Enter your configuration name
		SimpleIPConfig linkbusConfig = new SimpleIPConfig("MyLinkbusName");
		
		//Enter the LinkBus Link Local Unique IP
		linkbusConfig.setIp(IPAddress.toBytes("fe80::90de:6eff:fe00:af42"));
		//Enter the LinkBus Password
		linkbusConfig.setPassword("+aYN5g$AZv2Hf9xz");

	}
}

Open a communication Port

import java.io.IOException;

import com.devmel.communication.linkbus.Usart;
import com.devmel.storage.SimpleIPConfig;
import com.devmel.tools.IPAddress;

public class LinkBusVTG {

	public static void main(String[] args) {
		
		//Enter your configuration name
		SimpleIPConfig linkbusConfig = new SimpleIPConfig("MyLinkbusName");
		
		//Enter the LinkBus Link Local Unique IP
		linkbusConfig.setIp(IPAddress.toBytes("fe80::90de:6eff:fe00:af42"));
		//Enter the LinkBus Password
		linkbusConfig.setPassword("+aYN5g$AZv2Hf9xz");
		
		
		//We must use a communication.linkbus Object (Usart is used here)
		Usart usart = new Usart(linkbusConfig);
		try {
			//Open the communication
			if(usart.open()){
				
				//Toggle the VTG pin (and led)
				usart.toggleVTG();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			//Close the communication
			usart.close();
		}

	}
}

Displaying the Result

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