See this page in the Crickit guide on setting up MakeCode for micro:bit to set up for using Crickit extensions (mid-page).
This robot uses the Crickit and Sonar Extensions for the micro:bit MakeCode blocks. If you use the example code below, those are already added to that file. In the example, I have created some functions that handle the wheel movement code so that you just need to use the call forward, call back, call left, and call back blocks under Advanced > Functions.
Here is some code that will get you started by doing some simple obstacle avoidance: