Constructor for an M5 Stack Ultrasonic-I2C SONAR distance sensor object.
Namespace: IO.Devices.M5Stack_Ultrasonic_I2CAssembly: libsimpleio (in libsimpleio.dll) Version: 2.2026.283.1
Syntaxpublic 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