Hello Qiba

This program is the equivalent to the very famous Hello World in programming, but applied to our API. This program gets the firmware version from Qiba's devices and prints it to the screen.

Python3

import serial
ser = serial.Serial() #Create Serial Object
ser.baudrate = 115200 #Set the appropriate BaudRate
ser.timeout = 50 #The maximum timeout that the program waits for a reply. If 0 is used, the pot is blocked until readline returns
ser.port = '/dev/ttyACM0' # Specify the device file descriptor
ser.open() #Open the serial connection
ser.write(b'V\n') #Write the version command "V\n" encoded in Binary
s = ser.readline() # Read the response
print('Version:' + s.decode('ascii')) # Print it on the terminal, note the decoding to ascii.

To execute the program, just copy the code above to a file "helloqiba.py" and run it like shown below.

sudo python3 helloqiba.py

C#

Info

It is necessary to install the System.IO.Ports package to use this example:

[https://www.nuget.org/packages/System.IO.Ports/](https://www.nuget.org/packages/System.IO.Ports/)** **

using System.IO.Ports;

public class Program
{
static SerialPort _serialPort;

public static void Main()
{
// Create a new SerialPort object with default settings.
_serialPort = new SerialPort();

StringComparer stringComparer = StringComparer.Ordinal;

// Change the serial port properties:
_serialPort.PortName = "COM5"; //Change port device
_serialPort.BaudRate = 115200;
_serialPort.Parity = Parity.None;
_serialPort.DataBits = 8;
_serialPort.StopBits = StopBits.One;
_serialPort.Handshake = Handshake.None;

// Set the read/write timeouts
_serialPort.ReadTimeout = 500;


On This Page
Hello QibaPython3C#