Contents
Quick Start of PicoBle for PC
A Unity 3D object ‘glasses’ in the Demo scene tilts using acceleration the generated data of the Pico W. The Pico W generates 3D Object position data ‘x, y, z’ using the SIN function. The Pico W sends that data from the Pico W to Unity through Windows PC using the BLE (Bluetooth low energy) interface.
When clicking a Unity 3D object ‘Button’ in the Demo scene, Unity sends the numerical data obtained from the Unity 3D object ‘Inputfield’ to the Pico W. Unity works at Windows PC and sends the numerical data to the Pico W using the BLE (Bluetooth low energy) interface.
The following shows the capture screen when the Demo scene runs.
This Quick Start explains how to display the Demo scene on Unity using this asset. This Quick Start also includes some steps for downloading and setting up a package in Unity Project, and writing the Pico W code.
Step-1 Download and set up a package in Unity Project
Step-2 Write Pico W code using Arduino IDE
Step-3 Run Demo scene
Step-1 Download and set up a package in Unity Project
- Download this asset from the Asset Store, and click on the Import button.
- The package is imported under the Assets folder in your Unity project.
- Download the external plugin ’PicoBleConnect’ below and set it into the ‘Assets/PicoBleInterface/Scripts’ folder.
- Click the Project tab, choose ‘Assets’ > ‘Pico32BleInterface’ > ‘Scenes’ folder of the left side menu, double click on the Demo scene ‘PicoBleSampleScene’ in the Project window.
・ external plugin ’PicoBleConnect’
Step-2 Write Pico W code using Arduino IDE
- Connect the Pico W by Micro USB cable to Windows PC, then build a software development environment for this asset with the Arduino IDE according to ‘Arduino IDE v2 for Pico/Pico W’.
- Compile and write Pico W code ‘picoble.ino’ of the folder ‘/Assets /PicoBleInterface/picoble’ into the Pico W using the Arduino IDE.
Step-3 Run Demo scene
- In Windows PC, go to ‘Start’, choose ‘Settings’ > ‘Devices’ > ‘Bluetooth and other devices settings’. Click ‘Display other device’ to start searching for the device.
- Like below, select the Bluetooth device ‘USB Serial device (COM4)’ you want to add from the list.
- Click the ‘Play’ button on Unity. The Unity 3D object ‘glasses’ tilts in sync with the received data from the Pico W. The ‘Accelx, Accely, Accelz’ in the ‘PicBle Sample Code’ of the ‘Inspector’ tab displays the received data ‘x, y, z’ from the Pico W as follows.
- The ’console’ tab displays the game status as follows.
- The ‘Serial Monitor’ of Arduino IDE displays the data “x, y, z” as follows.
- Set No0 / No1 into Inputfield ’No0’ / Inputfield ‘No1’ in the game screen, then click the Button ‘On’ to send to the Pico W. Show Inputfield ’No0’ / Inputfield ‘No1’ as follows.
- The ’console’ tab displays the game status at clicking Button ‘On’ as follows.
- The ‘Serial Monitor’ in Arduino IDE displays the No0/No1 data as follows.
[ Not connect to Unity ]
[ Connect to Unity and send acceleration data ]