Ultrasonic Sensor

Function introduction

Petoi RGB Ultrasonic Sensor is a new module that integrates RGB LED and ultrasonic ranging. Only one GPIO is needed to operate the ultrasonic transceiver. While the ultrasonic probe measures the distance, the other GPIO pin can drive RGB LEDs with various light effects.

circle-info

The previous one:

Hardware setup

Connecting to the NyBoard with wire as shown in the following picture:

circle-info

The previous one:

Attach the ultrasonic sensor to Nybble's eyearrow-up-right.

Software setup

circle-info

Currently only supports the product Nybble, the software version 2.0, the mode can choose "Ultrasonic" or "RandomMind_Ultrasonic".

Use the latest OpenCat code to finish the setup. As shown below:

If you have already uploaded the latest OpenCat code to make Nybble walk, you only need to uncomment the #define ULTRASONIC at the beginning of OpenCat.ino then upload the code.

If you are not sure, you need to finish the upload process for the standard modearrow-up-right (Step 1 to Step 10) to ensure everything is configured correctly, then upload the code in the Ultrasonic mode.

If the Ultrasonic code is uploaded correctly, you can see success messages printed on the serial monitorarrow-up-right of Arduino IDE. As shown below:

Ultrasonic module code realization function: According to the different distances monitored by the ultrasonic module in real-time, the probe inside the ultrasonic module lights up with lights of different colors, and Nybble will make different action responses at the same time.

The demo video is as follows:

Mind+ demo code

file-download
287KB

Last updated

Was this helpful?