• The code as presented does exactly one trigger... on upload, and then everytime you enter in the console sensor.trigger().

    If you see it constantly doing something, you may have a grounding issue from the fact that you power Espruino from USB and your distance sensor device from you 5V power supply.

    Did you make a connection from GND of the device to GND of Espruino?

    If you do not have that, both GNDs are dancing around by the noise, and the noise constantly but irregulaerly triggers the device, 1st, and 2nd, the readings are not reliable either... ;)

About

Avatar for Rek @Rek started