MicroPython for ODROID-GO - Hello World

You will write code to display “Hello, ODROID-GO” on your ODROID-GO by following this guide.

We're providing a module for MicroPython development: odroid_go.py.
The module helps you to control the components on the board such as LCD, a lot of buttons, speaker, etc.
This module should be included first.

To prepare the board for use, it should be initialized. To initialize the board, use the GO.begin() function.
But the module calls GO.begin() function automatically when it loaded.

If you want to control the buttons on the board, you have to use the GO.update() function to apply the changes from the code.
The GO.update() function isn't used in this guide since only the LCD will be used to display a simple string.

Okay, let's see the initializing code.

from odroid_go import GO

This code will import GO instance from odroid_go.py module.
The GO instance has not only the 2 core functions but also a lot of helper functions that let you control the components on the board.

Now, let's use the GO.lcd functions to show “Hello, ODROID-GO”.

We will use the GO.lcd.print function to show a string.

from odroid_go import GO
 
GO.lcd.print("Hello, ODROID-GO")

This code would work like a charm, but the results text on the LCD will be too small to see.

Let's increase the font size by using the GO.lcd.set_font() function.
There're 4 different sizes of fonts implemented by default which you can select one of them accessing GO.lcd.fonts.*:

  • GLCDFONT, TT14, TT24, TT32

GO.lcd.fonts.GLCDFONT is the original Adafruit-GFX-Library 5×7 font.

from odroid_go import GO
 
GO.lcd.set_font(GO.lcd.fonts.TT24)
GO.lcd.print("Hello, ODROID-GO")

You can also change the text color with GO.lcd.set_color(). Change the text to green with keeping the background as black.
There're a few pre-defined colors that you can select one of them accessing GO.lcd.colors.*:

  • RED, GREEN, BLUE, BLACK, WHITE

You have to choose both of foreground and backgrounds color when you're using GO.lcd.set.color(fg, bg).

from odroid_go import GO
 
GO.lcd.set_font(GO.lcd.fonts.TT24)
GO.lcd.set_color(GO.lcd.colors.GREEN, GO.lcd.colors.BLACK)
GO.lcd.print("Hello, ODROID-GO")

After then, save and overwrite this code file as boot.py in the ODROID-GO module installation directory.

  • To execute this module properly, make sure you've uploaded ODROID-GO module. And you have to upload the written file called boot.py using rshell or ampy.
    • If you uploaded properly, MicroPython will execute boot.py when the device boots automatically.
    • Please refer to setup guide to further information: Install the ODROID-GO MicroPython module.
    • Or you also can do them in REPL. Write the codes line by line in order.

Upload the boot.py file using rshell or ampy, enter to REPL prompt, and restart ODROID-GO.

If the procedure goes well, you can see “Hello, ODROID-GO” on your device.

The complete example is available in following path:

  • odroid_go/examples/hello_world/hello_world.py

Copy and paste to try the example.