Go Lang Sample
Go is gaining ground in many applications in the present, and at Qiba, we like to keep track of where technology is headed, so we built this very simple example to control our MDB Products (Pi Hat or MDB-USB) using this language.
Prerequisites
- Go language (learn how to install in https://golang.org/doc/install)
- Git (for downloading dependencies)
Program Functionality
This program is designed to operate a single MDB Controller (Pi Hat or MDB-USB) and do a single vend in Idle Mode , also known as Authorization First Mode.
Usage
Since the program needs to be run with elevation (high permissions), it is necessary to build its binary instead of using "go run", and then run the binary with elevation. In the examples below, $DEVICE is the name of the OS device that is connected to the MDB.
DEVICE="/dev/ttyACM0"
go get github.com/tarm/serial
go build
sudo ./MDBGoDialog -device $DEVICE
This program is able to be ran in windows, but access to Serial Buffer is not given as fast as in Linux, so there might be systems where it does not run according to the expected.
$DEVICE="COM4" #Example PORT NAME
go get github.com/tarm/serial
go build
.\MDBDialog.exe --device $DEVICE
Download Source Code
The source code is available in this Link: http://firmware.qibixx.com/mdbgodialog.zip