Control the Car with APP¶
This section will guide you through building a remote project using the Sunfounder Controller APP, which means you can use your phone/tablet to control your Pico-4wd car.
1. Setup SunFounder Controller
Install SunFounder Control APP from APP Store(iOS) or Google Play(Android).
Open SunFounder Controller and click on the + to create a new controller.
We have preset controller for Pico-4wd, you can choose it directly.
Define a name for this Controller and click Confirm.
Now that you are inside this preset controller, click the Grayscale Values widget’s Settings button to change its reference value.
The following thresholds should be modified based on the values obtained in the Test the Grayscale Sensor Module section.
Once you have set it up, click the Save button in the upper right corner to save it. If you need to make any changes, click the Edit button again.
2. Make the app_control.py file run on boot
In order for Pico-4wd to be able to run specific scripts without being connected to a computer, and then be controlled by SunFounder Controller. You need to save the specific script to the Raspberry Pi Pico with the name main.py, as follows.
Open the
app_control.py
file under the path ofpico_4wd_car_main\examples
, then click “run current script” button or just press F5 to run it.If you run the code, you will see this IP in the shell; remember it, as it may be used to connect to SunFounder Controller later on.
Stop the script from running and click File -> Save as or press
Ctrl+Shift+S
, then select Raspberry Pi Pico in the popup window that appears. If this pop-up does not appear on yours, make sure you have plugged the Pico into your computer with a micro USB cable and select the “MicroPython (Raspberry Pi Pico).COMXX” interpreter in the bottom right corner.Set the file name to
main.py
. If you already have the same file in your Pico, it will prompt to overwrite it.
Now you can unplug the USB cable, turn on the power switch of Pico-4wd, and Pico-4wd will automatically run this main.py
script.
3. Connect to Pico 4WD car
Find
my_4wd_car
on the WLAN of the mobile phone (tablet), enter the password12345678
and connect to it.The default connection mode in
app_control.py
is AP mode. So after you connect, there will be a prompt telling you that there is no Internet access on this WLAN network, please choose to continue connecting.Now go back to SunFounder Controller, when you click the Connect button, it will automatically search for robots nearby.
Click on the
my_4wd_car
.Note
You need to make sure that your mobile device is connected to the
my_4wd_car
LAN.If it doesn’t search automatically, you can also manually enter your car’s IP to connect.
Once you click on my_4wd_car
, the message “Connected Successfully” will appear and the product name will appear in the upper right corner.
4. Run this Controller
Click the Run button to start the controller.
![]()
Here are the functions of the widgets.
A: Drive the car at 0~100% power. Before controlling the car movement with the K widget, you must set the A widget to 30% or more.
B: The display of the car moving speed, unit: cm/s.
C: Display of car speed in digital format.
D: Radar display of obstacles detected by ultrasonic module.
G: Turn on/off WS2812 RGB board.
H: Show the data of the three sensors on the grayscale module, which have three states: black block: black line detected; white: white detected; exclamation point: cliff detected.
K: Control forward, backward, left, and right motions of the car.