# Microbit V2 random movement

**URL:** <https://forum.makecode.com/t/microbit-v2-random-movement/16392>\
**Category:** micro:bit\
**Created:** [November 17, 2022, 8:58pm UTC](https://forum.makecode.com/t/microbit-v2-random-movement/16392 "2022-11-17T20:58:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kymhanson](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kymhanson](https://forum.makecode.com/u/kymhanson)\
**Post date:** [November 17, 2022, 8:58pm UTC](https://forum.makecode.com/t/microbit-v2-random-movement/16392/1 "2022-11-17T20:58:31Z")

</div>

Hello,

I am wanting to use a microbit V2 to move randomly? Is this possible?

---

<div class="post-metadata">

**Author:** ![dsssssssss9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dsssssssss9/32/861_2.png) [@dsssssssss9](https://forum.makecode.com/u/dsssssssss9)\
**Post date:** [November 17, 2022, 9:38pm UTC](https://forum.makecode.com/t/microbit-v2-random-movement/16392/2 "2022-11-17T21:38:45Z")

</div>

Hi  
Great to meet you …

“Move randomly”?

What do you want to move ?  
The MicroBit itself ?  
One of the led on the display ?

More detailed information on what you want to achieve will be helpful

I’m sure knowing the community here , once we know we will be only too pleased to help

---

<div class="post-metadata">

**Author:** ![kymhanson](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kymhanson](https://forum.makecode.com/u/kymhanson)\
**Post date:** [November 17, 2022, 11:28pm UTC](https://forum.makecode.com/t/microbit-v2-random-movement/16392/3 "2022-11-17T23:28:04Z")

</div>

Sorry that was a little vague - I am wanting to make a toy which moves randomly - I have a move motor so was looking at coding the microbit V2 to move randomly. When it gets near an a wall etc it changes direction?

---

<div class="post-metadata">

**Author:** ![dsssssssss9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dsssssssss9/32/861_2.png) [@dsssssssss9](https://forum.makecode.com/u/dsssssssss9)\
**Post date:** [November 21, 2022, 1:19am UTC](https://forum.makecode.com/t/microbit-v2-random-movement/16392/4 "2022-11-21T01:19:02Z")

</div>

thanks for the update - the more details about the project the better i usually find!

How are you detecting when the device is near a wall?

do you have any example code or video you are willing to share?
