Simple demo of using the tinyLiDAR sensor on SCRATCH for Raspberry Pi.
Connect pins as described below and press the 'up' arrow key to start or click the green flag.
Press the 'down' arrow key to stop.
Slowly bring your hand near the sensor and listen to the sound effects :)
Distance is shown in the top right corner.
Raspberry Pi Connections for the 40pin connector:
RED is +3.3v from pin 1
BLACK is GND from pin 39
WHITE is ECHO to pin 37 (BCM26)
YELLOW is TRIG from pin 36 (BCM16)
Note: the tinyLiDAR sensor must be preset to 'ultrasonic emulation mode' before connecting to the pi. See Instructable ('Can I Use tinyLiDAR In... Scratch?') or user manual at tinylidar.com for more details.