The HC-SR04 is an inexpensive distance sensor based on a pair of ultrasonic transducers with a straightforward TTL level interface and a claimed range of 2cm to 4m. Similar sensors are now commonplace with the widespread use of car parking assistance sensors.
This project demonstrates distance measurement in Microsoft MakeCode inspired by the BBC micro:bit example starting with a very simple program and then showing more features of MakeCode and the Circuit Playground Express (CPX) board.
If you are new to using MakeCode, check out the guide to getting started first.
Thank-you to George and Edward for the loan of their CPX board.
Parts
Text editor powered by tinymce.