yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
Pico Robot Car📖
0.Introduction
  • 0.1 Description of Pico Robot
  • 0.2 Interface Description
1.Assembly steps
  • Assembly video
2.Development environment construction
  • 2.1 Update firmware
  • 2.2 Build environment
  • 2.3 Download code Startup automatically
  • 2.4 Import library file
3.Basic course
  • 3.1 Control LED light
  • 3.2 Onboard temperature sensor
  • 3.3 Passive buzzer
  • 3.4 Breathing light
  • 3.5 Marquee light
  • 3.6 OLED display
  • 3.7 Battery power display
  • 3.8 Servo control
4.Advanced course
  • 4.1 Light sensor
  • 4.2 Sound sensor
  • 4.3 Tracking sensor
  • 4.4 Ultrasonic sensor
  • 4.5 IR control display
5.Robot course
  • 5.1 Car forward
  • 5.2 Car movement
  • 5.3 Singing dancing
  • 5.4 Car tracking
  • 5.5 Edge detection
  • 5.6 Ultrasonic avoiding
  • 5.7 Ultrasounic following
  • 5.8 Light follow
  • 5.9 Voice control car
  • 5.10 Infrared control
  • 5.11 Bluetooth control
6.Battery and charge
  • Battery and charge
Download
  • APP(iOS/Android)
  • Code
  • Instructions Manual
  • Appendix
Download ZIP

Welcome to Pico Robot Car repository

3.6 OLED display

3.6 OLED display

1. Learning objectives

  1. Learn to combine the Raspberry Pi Pico 2/Pico mainboard and the OLED display of the car expansion board for experiments.
  2. Understand the use of OLED display.

2. Hardware use

This course uses the Pico 2/Pico mainboard and the OLED display of the car expansion board. Note that before running this section of the routine, the OLED display must be plugged in, otherwise the program will report an error.

image-20220302114910448

OLED display is a display made of organic light-emitting diodes. Because it has both self-luminous organic light-emitting diodes, it does not require a backlight, has high contrast, thin thickness, wide viewing angle, fast response speed, wide operating temperature range, and simpler structure and process. The 0.91-inch OLED screen we use uses IIC communication, which saves IO pins and simplifies the control method.

3. Program analysis

Code path: Code -> 1.Basic course -> 6. OLED display.py

​x
from machine import Pin, I2C
from pico_car import SSD1306_I2C
import time
# set IIC pin
i2c=I2C(1, scl=Pin(15),sda=Pin(14), freq=100000)
# initialization oled
oled = SSD1306_I2C(128, 32, i2c)
# oled show hello at 0,0
oled.text('Hello', 0, 0)
oled.show()
oled.fill(0)
time.sleep(1)
# oled show World at 0,10
oled.text('World', 0, 10)
oled.show()
oled.fill(0)
time.sleep(1)
# oled show spot at 100,30
oled.pixel(100, 30, 1)
oled.show()
oled.fill(0)
time.sleep(1)
​

from pico_car import SSD1306_I2C

Use pico_car's SSD1306_I2C, which is our packaged OLED library.

import time

The "time" library. This library handles everything to do with time, from measuring it to inserting delays into your program. The unit is seconds.

from machine import Pin, I2C

The machine library contains all the instructions MicroPython needs to communicate with Pico and other MicroPython-compatible devices, extending the language of physical computing. Only the Pin and I2C libraries are used here.

i2c=I2C(1, scl=Pin(15),sda=Pin(14), freq=100000)

Set IIC 1 pin to SCL 15, SDA 14, and frequency to 100000.

oled = SSD1306_I2C(128, 32, i2c)

Initialize the size of OLED to 128*32, and pass the previously set IIC parameters into it.

oled.text('Hello', 0, 0)

Set OLED to display 'Hello' at position 0,0.

oled.show()

Display the set OLED content.

oled.fill(0)

Clear the set content and prepare for the next display.

oled.pixel(100, 30, 1)

Set the pixel at the coordinate 100,30 of OLED to light up. If oled.pixel(100, 30, 0) is set to turn off the pixel at the coordinate 100,30.

4. Experimental Phenomenon

After the program is downloaded, we can see that OLED first displays 'Hello', then displays 'World' in the next line, and then displays a dot at the coordinate 100,30.

Marquee light
Battery power display

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文