# Block coding
piBo Maker uses Blockly for block coding. Besides the standard blocks there are piBo blocks that call
the **openpibo** Python package. The [Python code] button shows the Python code your blocks make.
```{note}
This page is generated from the IDE toolbox (`docs/tools/gen_block_guide.py`). Each picture shows the block as it comes out of the toolbox.
Everything runs **inside piBo**. Only the [Collect] category needs the internet, and it is only in the Korean edition.
```
## Categories
```
Standard Blockly blocks (hover over a block to see what it does)
├── Logic (7)
├── Loops (5)
├── Math (13)
├── Text (15)
├── Lists (12)
├── Colour (4)
├── Variables (appear when you make one)
└── Functions (appear when you make one)
piBo blocks
├── Start (1)
├── Audio (4)
├── Collect (4)
├── Device (8)
├── Motion (10)
├── Oled (11)
├── Speech (8)
├── Vision (16)
├── Rec (36)
└── Utils (12)
```
## piBo blocks
### Start
Run the code.
### Audio
Select and play audio at set volume.
Enter music file name to play.
Stop the audio currently playing.
Record for a set time and save as a file.
### Collect
```{note}
Korean edition only (Korean weather regions and a Korean news feed). The Global edition does not have this category.
```
(Internet!) Search Wikipedia with the given keyword. *returns a value*
(Internet!) Search for comprehensive weather information in a specific area. *returns a value*
(Internet!) Search for weather information in a specific area. *returns a value*
(Internet!) Retrieve search results with news keywords. *returns a value*
### Device
Turn on eye LED
Turn on eye LED with a color variable.
Check adapter connection status. *returns a value*
Check battery status. *returns a value*
Check system messages. *returns a value*
Detect presence of people. *returns a value*
Detect touch. *returns a value*
Check button status. *returns a value*
### Motion
Retrieve list of available motions. *returns a value*
Retrieve list of custom motions. *returns a value*
Execute a chosen motion a specified number of times.
Execute an entered motion a specified number of times.
Execute a custom motion.
Initialize motion settings.
Move a specified motor to a certain degrees.
Set the speed of the motor.
Set the acceleration of the motor.
Moves all motors to a certain degrees by the specified time.
### Oled
Set the font size on the OLED display.
Display text on the OLED screen.
Display dynamically selected image on OLED.
Display a specified image on OLED.
Display a specified image data on OLED.
Draw a rectangle on OLED.
Draw an ellipse on OLED.
Draw a line on OLED.
Invert colors on the OLED screen.
Display content on OLED screen.
Clear the OLED screen.
### Speech
Listen with the robot microphone and turn speech into text when you stop talking. Runs on the robot; Korean and English are detected automatically. The first call takes a few extra seconds to get ready. *returns a value*
Make speech on the robot and save it to a file. Korean and English are detected automatically.
Make speech on the robot and say it. Korean and English are detected automatically.
Save text as espeak robot voice to a file.
Say text with the espeak robot voice.
Start LLM server.
Send text to the LLM server and get a reply. The system prompt sets how piBo should answer. *returns a value*
Stop the LLM server.
### Vision
Capture an image. *returns a value*
Load a specified image file. *returns a value*
Load an image file. *returns a value*
Create a blank image filled with the chosen color. *returns a value*
Save as an image file.
Display an image variable in IDE.
Display an image variable in OLED.
Draws a rectangle on the image.
Displays a circle in the image.
Displays a line in the image.
Display text on the image.
Transform image style. *returns a value*
Resize the image. *returns a value*
Turns the 6×8 picture you draw by tapping dots into an image (scaled to the camera size). *returns a value*
Turns the 8×4 picture you draw by tapping dots into an image (scaled to the camera size). *returns a value*
Turns the 8×8 picture you draw by tapping dots into an image (scaled to the camera size). *returns a value*
### Rec
Detect and identify faces in the specified image. *returns a value*
Show faces in the image.
Analyze face in image(age, gender, emotion) *returns a value*
Show face analysis in the image
Find face landmark in the image *returns a value*
Show face landmark in the image.
Get the list of names in the face dictionary. *returns a value*
Train face from image.
Delete a specific face from training faces.
Recognize who faces are in an image. *returns a value*
Save face training data to file.
Load face training data from file.
Analyze face direction/distance in the image. *returns a value*
Show face direction/distance in the image
Load Object detection model
Find objects in the image. *returns a value*
Find objects in the image. (RAW) *returns a value*
Show objects in the image.
Find QR in the image. *returns a value*
Find QR in the image. (RAW) *returns a value*
Show QR codes in the image.
Identify and analyze human poses in the specified image. *returns a value*
Show pose data in the image.
Evaluate and interpret pose data from the image and save the results. *returns a value*
Set a tracker for a specific location in the image.
Track thing in the image. *returns a value*
Show tracking result in the image.
Load Hand gesture model.
Load Hand gesture model
Recognize Hand gesture in the image. *returns a value*
Show hand gesture in the image.
Detect Marker in the specified image. *returns a value*
Show marker in the image.
Load a model you taught and saved in the Classifier. Folder mymodel, then the model name. (image, hand, face, pose)
Classify the image with the loaded classifier model and return the best matching name. Hand, face and pose models return empty text when no hand, face or body is in view. *returns a value*
Draws what the last [Classify with classifier model] saw on that image: points and bones for hand and pose, points for face, plus the class name and probability.
### Utils
Pause the process for a specified duration of seconds.
Retrieve the current time value. *returns a value*
Obtain the current time. *returns a value*
Verify if an element is included in a list or array. *returns a value*
Retrieve the value associated with a specific key in a dictionary. *returns a value*
Add a new key-value pair to an existing dictionary.
Generate a new empty dictionary. *returns a value*
Set the values of the specified range in the array.
Confirm the existence of a file or directory. *returns a value*
Change a variable's type to String. *returns a value*
Convert a variable to a specific numeric type. (Integer or Float) *returns a value*
Get angle *returns a value*