Welcome to RDK X5 MagicBox repository
Basic Peripheral Usage
Basic Peripheral Usage
The development board file structure is as follows. In the /userdata/magicbox/basic_function_demo/ directory, there are preset use cases for basic peripherals. Execute the program to control the corresponding peripherals.
xxxxxxxxxxroot@ubuntu:/userdata/magicbox# tree -L 2.├── app #Application function files│ ├── ros_ws # ros2 workspace, basically contains all application functions│ └── Web_RDK_Performance_Node #Resource monitoring application|├── basic_function_demo #Basic peripheral usage examples (python)│ ├── button.py #Button usage script│ ├── imu.py # IMU usage script│ ├── servo.py #Servo control script│ └── ws2812b.py #Light strip control script|├── config #Configuration files required by app│ └── ......├── dep #Third-party function packages required by app│ ├── llama.cpp # llama.cpp│ ├── matcha-icefall-zh-baker # TTS voice model dependency│ └── sherpa-onnx # sherpa-onnx|├── launch #Files related to launch functions│ ├── lamp #Light control scripts required for startup│ ├── start.py #Control script for starting and stopping all application functions│ └── start.sh #Auto-start execution script|├── log # log files|└── voice #Audio files ├── robot.mp3 └── wakeup.mp3
Servo Control
xxxxxxxxxx# Control the two support feet to extend downward and lift the device, based on PWM implementationpython3 /userdata/magicbox/basic_function_demo/servo.py
Light Control
xxxxxxxxxx# Control the device light to turn on and display different colors, based on SPI implementationpython3 python3 /userdata/magicbox/basic_function_demo/ws2812b.py
IMU Control
xxxxxxxxxx# Run IMU and print data, based on smbus2 implementationpython3 /userdata/magicbox/basic_function_demo/imu.py 
Button Control
xxxxxxxxxx# Run button press feedback, press the button and print button1 OK/button2 OK/button3 OK, based on GPIO implementationpython3 /userdata/magicbox/basic_function_demo/button.py