Installing BasicMicro Libraries and Downloading Code from GitHub

Spread the love

BasicMicro’s official libraries install through standard package managers: the Arduino library through the Arduino IDE’s Library Manager and the Python library with pip. All libraries and example code are also hosted on GitHub, where repositories can be downloaded as ZIP files or cloned with the Git client.

GitHub logo
Figure 1: BasicMicro’s libraries and example code are hosted on GitHub.

Installing the Official Libraries

The easiest way to get the official libraries is through each platform’s normal package manager — no Git or GitHub required.

Library Platform Install
basicmicro_arduino Arduino, ESP32, ESP8266 Arduino IDE Library Manager, search “Basicmicro”
basicmicro_python Python 3, Raspberry Pi, Linux, Windows, macOS pip
basicmicro_ros2 ROS 2 See the repository README

To install the Arduino library, open the Arduino IDE, go to the Library Manager, search for “Basicmicro”, and click Install. The same library supports Arduino, ESP32, and ESP8266 boards.

To install the Python library, run:

pip install basicmicro

The overview on BasicMicro’s GitHub page also covers installation for each library along with links to documentation and examples.

Git and GitHub

Git is a piece of software used for keeping track of changes to code over time. Git stores code for projects or libraries in units called repositories. GitHub is a popular service for storing and distributing Git repositories. BasicMicro hosts its official libraries and example code on GitHub at github.com/basicmicro. The rest of this guide covers two methods of obtaining code directly from these repositories: downloading a ZIP file and cloning with the Git client.

Downloading a ZIP File

The first method for pulling code from GitHub is downloading a ZIP file of the repository. No tools other than a web browser are needed for this method.

  1. Using a web browser, navigate to the desired repository, starting from BasicMicro’s GitHub page.

  2. Locate the green button labeled “Code” and click it.

    Repository download dialog on GitHub
    Figure 2: The dialog used to download a zipped version of the repository.
  3. In the dialog that opens, click on “Download ZIP”.

  4. Move the downloaded ZIP file to a useful location and unzip the file to use the code.

Cloning with the Git Client

The second method for pulling code from GitHub is to use the Git client software. The Git client will need to be installed on the computer in use.

  1. Install the Git client on the machine being used. There are versions available for Windows, macOS, and Linux, and the download for each OS can be found here.

  2. Using a web browser, navigate to the desired repository, starting from BasicMicro’s GitHub page.

  3. Click the green button labeled “Code” and note the address of the repository shown in the dialog.

    Repository address shown in the GitHub Code dialog
    Figure 3: The address of the repository in the opened dialog.
  4. Open a terminal window on the computer and navigate to where the cloned repository should be stored.

  5. Type “git clone” followed by the address of the repository from the dialog and press Enter. The repository will be cloned into the current directory. For example:

    git clone https://github.com/basicmicro/basicmicro_python.git
  6. Enter the directory created by the cloning process to view and use the code in the repository.

Next Steps

With a library installed, these guides put it to work: