Coding++ – Coding beyond screens

Distance Element

Use it in a remote‐controlled car to stop it from going too close to an object or use it to calculate the area of a room. Program the Plezmo Distance so that the Plezmo Light turns on when someone approaches the door.

Find out how far something is with the Plezmo Distance Element. It can measure distances up to 1 meter/ 3 feet or 100 centimeters.

Proximity:
Sense if an object is far or near
Measuring
Distance

What's Inside

Size: 40mm x 40mm x 10mm

Battery Life: approximately 4hrs

Key hardware components:

  • Smart power module to regulate the power to the element and manage charging of the battery
  • Intelligent BLE-module for communication with Apps
  • Tricolor (RGB) LEDs for status indications
  • Accelerometer to support basic features like double-tap to wake-up
  • Long-lasting 250mAH Li-Polymer battery
  • An intelligent time of flight LiDAR sensor which has a detection range of upto 2m

Near / Far

def distanceEventListener1():

pass

# Whenever distance sensor detects a NEAR event

Distance.onDistanceEvent(‘Distance’, distanceEventListner1, DistanceEvent.NEAR)

Distance Value

# Define what qualifies as NEAR for e.g. <10cm is NEAR

Distance.setDistanceThresholdCM(‘Distance’10)

Measuring

# Get the distance value of an object from the sensor

Distance.getDistanceCM(‘Distance’)

Here are some videos you can watch

Scroll to Top