The most recent NuScratch on Raspbian supports the generic HR04 ultrasonic sensors directly. Wire them up in the simple 4-wire manner like this -
Simon's code expects the sensor to be wired a bit differently and you can't mix them up!
In Scratch, open the 'examples' folder and then 'sensors and motors' and load 'gpio-ultrasonicDemo'
Making Smalltalk on ARM since 1986; making your Scratch better since 2012