BqBus Protocol

BqBus is an extremely simple and intuitive open source communication protocol, whose objective is to allow data transmission between embedded devices and high-level computer systems, prioritizing performance and ease of implementation.

It’s currently available for use on Arduino platforms, and computational applications developed with Visual Studio Community. However, the simplicity of its implementation allows any user to easily port the code to other applications.

Example LedBuiltInControl.ino of library on execution

Below is the sample code present in the BqBusArduino library, whose execution is demonstrated in the video above. The executable application is already included in the library to facilitate testing.


/**
 * @file LedBuiltInControl.ino
 * @author Wesley José Santos (https://binary-quantum.com)
 * @brief Arduino code example to work with LedBuiltInCotrol.exe
 * Repo of visual studio application: https://github.com/WesleyJoseSantos/BqBusNet
 * @version 0.1
 * @date 2020-05-16
 * 
 * @copyright Copyright (c) 2020
 * 
 */

#include "BqBus.h"

BqBus pcApp(1);      //Instance to share 1 register with pcApp application

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);                               //Initialize serial port
  pcApp.setBus(Serial);                             //Set serial port used to communicate with pcApp application
  pinMode(LED_BUILTIN, OUTPUT);                     //Configure board default output to control on-board led
}

void loop() {
  // put your main code here, to run repeatedly:
  pcApp.communicationTask();                      //Performs communication betteen arduino and pcApp application
  int cbValue = pcApp.getReg(0);                  //Get value from register address 0 (check box)
  digitalWrite(LED_BUILTIN, cbValue);             //Write check box value on led
}

The control window code developed in visual studio follows below

using System;
using System.Windows.Forms;
using System.IO.Ports;
using BqBusNet;

namespace Tester
{
    public partial class Form1 : Form
    {
        SerialPort serial = new SerialPort();
        BqBus arduino = new BqBus();

        public Form1()
        {
            InitializeComponent();
            serial.PortName = "COM7";
            arduino.Serial = serial;
            arduino.Size = 1;
        }

        private void BtConnect_Click(object sender, EventArgs e)
        {
            var bt = (Button)sender;
            if (arduino.IsConnected)
            {
                arduino.Disconnect();
                bt.Text = "Connect";
            }
            else
            {
                arduino.Connect();
                bt.Text = "Disconnect";
            }
        }

        private void CbLed_CheckedChanged(object sender, EventArgs e)
        {
            var cb = (CheckBox)sender;
            int value = cb.Checked ? 1 : 0;
            arduino.SetReg(0, value);
        }
    }
}

To access the complete repositories use the links below:

Library BqBus for Arduino

Biblioteca BqBus for Visual Studio .NET

Sign up to receive updates, news, and programming tips.

Create your website at WordPress.com
Get started