Ultrasonic Sensor
Overview
Used for ultrasonic positioning, distance measurement, obstacle avoidance, and other application scenarios. Uses I2C communication to return distance values to the main controller.
Technical Specifications
Operating voltage: VCC 3.3V -5V
Module dimensions: 32*48mm
Mounting: 2 plastic building block compatible through-holes
Measurement range: 10-200cm
Pin Definition
Pin |
Definition |
|---|---|
GND |
Ground |
VCC |
Power |
SCL |
I2C clock |
SDA |
I2C data |
Example Code
Graphical code
from mpython import *
from bluebit import *
import time
ultrasonic = Ultrasonic()
while True:
oled.fill(0)
oled.DispChar(str(str('Distance: ') + str(ultrasonic.distance())), 0, 0, 1)
oled.show()
time.sleep(0.1)