Click or drag to resize

Sensor Constructor

Constructor for an M5 Stack Ultrasonic-I2C SONAR distance sensor object.

Namespace: IO.Devices.M5Stack_Ultrasonic_I2C
Assembly: libremoteio (in libremoteio.dll) Version: 2.2026.283.1
Syntax
C#
public Sensor(
	Bus bus,
	int addr = 87,
	bool stretch = false
)

Parameters

bus  Bus
I2C bus controller.
addr  Int32  (Optional)
I2C slave address.
stretch  Boolean  (Optional)
Indicates the I2C bus controller can properly handle I2C clock stretching.
Remarks
The M5 Stack Ultrasonic-I2C module pulls SCL low (i.e.I2C slave clock stretch) for 50 milliseconds after accepting the ping command. On Raspberry Pi's 1 to 4, which do not support I2C slave clock stretch, we have to wait it out with a safe margin before reading the echo response bytes. The RP1 I/O Controller on Raspberry Pi 5 boards does support clock stretching.
See Also