Quickstart by Python on Repl.it

In this page, we try running obniz with Python on the Web, using repl.it. Installation of Python on PC will not be explained.

Buy obniz

obniz is now available on Official Online Store.
It is also available on the websites and stores listed on List of Stores.
We accept worldwide shipping.

Connect Wi-Fi

Wi-Fi should have DHCP and 2Ghz band.
(If you need a mac address of your obniz, plug your obniz to power while pressing the switch to display the menu. "DisplayInfo" shows the mac address.)

  1. Turn on the obniz by plugging in a micro-USB. (to shutdown, just unplug the cable)
    obniz will then show a image like below to show you where the switch is. Press the switch to proceed.
  2. obniz will show a Wi-Fi SSID list on its display. Choose one by moving the switch towards left or right, and confirm selection by pressing the switch.
  3. Type the password one by one by using the switch. When you finish, choose "END" to connect.
  4. QR code will appear on its display when successfully connected to Wi-Fi and obniz Cloud.

How to use Repl.it

Use [repl.it] (https://repl.it) as the Python execution environment.
If you already have other environment, you can use it.

Access this URL: https://repl.it/languages/python3.
The following screen will be displayed.
ScreenShot

The left side of the screen is the editor to write the program, the right side is the console where the output result can be seen.

First of all, Let's prepare to write program for obniz.
(You can also access the page that have completed sample program input, by clicking the following URL:
https://repl.it/repls/YawningWhitesmokeScreencast )

  1. Click the box icon on the upper left side of the screen
  2. Click "search for a package" and type "obniz"
  3. Click "obniz: ~" displayed below the entered part
  4. Click the + button and the obniz SDK is ready!

HowToImportObnizSDK
Let's go back to the programming screen by clicking the icon on the box icon and selecting "main.py" from the displayed one and clicking.

Let's try!

You are now ready to write the program for obniz!
Let's copy and paste the following program and run it.
You can run it by clicking "run" located above the editor area.
Please enter your obniz id (8-digit number displayed on obniz) in OBNIZ_ID_HERE (ex: 1234-5678).

import asyncio
from obniz import Obniz

async def onconnect(obniz):
    obniz.display.clear()
    obniz.display.print("Hello, World!")

obniz = Obniz('OBNIZ_ID_HERE')
obniz.onconnect = onconnect

asyncio.get_event_loop().run_forever()

When executed, you should see "Hello, World!" on the display of obniz.
By rewriting the obniz.display.print("EDIT_HERE") part, you can display your favorite character string (alphanumeric characters only)!
During execution, the "run" button changes to "stop". By clicking on this you can terminate the program.

With this short program, obniz was able to run from Python!



Next : Turning on a LED