09. oled prints the status of the Raspberry Pi1. Learning objectives2. Experimental preparation3. Core code analysis4. Experimental phenomenon
Use the 12832oled screen to display the status of the Raspberry Pi.
begin()
Function explanation: Initialize OLED, return True if successful, return False if failed
xxxxxxxxxx
clear()
Function explanation: Clear the display. refresh=True refreshes immediately, refresh=False does not refresh.
xxxxxxxxxx
getCPULoadRate()
Function explanation: read CPU usage
xxxxxxxxxx
getSystemTime()
Function explanation: read system time
xxxxxxxxxx
getUsagedRAM()
Function explanation: read memory usage and total memory
xxxxxxxxxx
getUsagedDisk()
Function explanation: read TF card space usage / TF card total space
xxxxxxxxxx
getLocalIP()
Function explanation: get local IP
xxxxxxxxxx
add_text(start_x, start_y, text, refresh=False)
Function explanation: add characters. start_x start_y indicates the starting point. text is the character to be added. refresh=True refreshes immediately, refresh=False does not refresh.
xxxxxxxxxx
add_line(text, line=1, refresh=False)
Function explanation: Write a line of text. refresh=True refresh immediately, refresh=False do not refresh. line=[1, 4]
xxxxxxxxxx
refresh()
Function explanation: Refresh OLED, display content
Source code path: project_demo/03.Basic_car_course
Turn on the robot, open the computer browser to enter the Jupyter lab editor
Enter the source code path, double-click the code to be run
Restart the kernel and clear all outputs
Click the first code block, then click the run button to start running one by one
After the program runs, as the code blocks run, the oled screen will display the status information of the Raspberry Pi.