Initializing a project

This tutorial will walk you through how to initialize a app project and display “Hello” on kublet.

You will learn how to use our Krate CLI to:

  • Initialize a basic project
  • Install dependencies
  • Build code
  • Flash code

You will also learn how to set kublet to developer mode with our mobile app.

At the end of the tutorial, you should be familiar with the basic directory structure of your code, how to manage displays, and how to upload your code to kublet.

Estimated time: 10 mins

Prerequisites

Before you begin this tutorial you must:

  • Have WiFi connection
  • Install krate, our command line tool
  • Install our mobile app (iOS/Android)
  • An IDE (VS Code/PIO recommended)

Create project

If you plan to publish your app on community, you could start by forking and cloning our community repository, then cd into the krates directory and initialize your project there. Otherwise, cd into your workspace and run the following in your terminal:

$ cd /path/to/workspace OR cd community/app
$ krate init <name of directory> 

If you’re publishing the app onto our community platform, the name of the directory should be a single word in small caps and represent the name of your app. This name will be displayed on our mobile app.

After initializing your project from the command line, open VS Code in a new window and open your project directory. Once your project is loaded, PIO automatically downloads dependencies for your project as declared in the platformio.ini file.

If not using PIO IDE, simply run krate deps install to install dependencies for your project.

Build code

Build your code locally by running this command in your terminal:

$ krate build

If successful, you should see

RAM:   [=         ]  14.5% (used 47548 bytes from 327680 bytes)
Flash: [=======   ]  66.6% (used 872453 bytes from 1310720 bytes)
====================================== [SUCCESS] Took 3.27 seconds ======================================

Flash code

Developer mode

In order to flash code to your kublet device we need to set kublet to developer mode. Open our mobile app and search for our developer app.

Upload our developer app onto kublet:

mobiledeveloperapp

This only needs to be done once as you start your development process. Every time you start developing, you will have to first load our developer app onto kublet to set it to developer mode.

Once uploaded, you will see the IP address of your kublet on display. Take note of this IP.

Upload App

Upload your compiled code by running the following in the terminal:

$ krate send <IP-address>

Replace IP-address with the address displayed on the screen.

Example
$ krate send 192.168.0.10

If all goes well, you should see “Hello” displayed on kublet.

We will go over the code in the next sections.