In this page, we try running obniz with Python on the Web, using repl.it. Installation of Python on PC will not be explained.
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.)
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.
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:
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.
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!