located:
cd adeept_picarpro/server/
3. View the contents of the current directory file:
ls
4. Enter the command and press Enter to run the program:
sudo python3 OLED.py
5. After running the program successfully, you will observe that the word
"GEWBOT.COM" will be displayed on the OLED screen.
6. When you want to terminate the running program, you can press the shortcut key
"Ctrl + C" on the keyboard.
6.4.2 The main code program of this lesson
For the complete code, please refer to the file OLED.py.
from
1.
luma.core.interface.serial
from
2.
luma.core.render
from
3.
luma.oled.device
import
4.
time
5.
6.
serial = i2c(port=1, address=0x3C)
7.
device = ssd1306(serial, rotate=0)
8.
9.
text_1 =
'GEWBOT.COM'
10.
text_2 =
'IP:CONNECTING'
11.
text_3 =
'<ARM> OR <PT> MODE'
12.
text_4 =
'MPU6050 DETECTING'
13.
text_5 =
'FUNCTION OFF'
14.
text_6 =
'Message:None'
import
i2c
import
canvas
import
ssd1306
# Define the text displayed on the OLED screen, up to 6 lines.
80
Need help?
Do you have a question about the PiCar-Pro and is the answer not in the manual?