# Any help or guidance in making my own code blocks for a motor hat

**URL:** <https://forum.makecode.com/t/any-help-or-guidance-in-making-my-own-code-blocks-for-a-motor-hat/17477>\
**Category:** micro:bit\
**Created:** [January 17, 2023, 5:57pm UTC](https://forum.makecode.com/t/any-help-or-guidance-in-making-my-own-code-blocks-for-a-motor-hat/17477 "2023-01-17T17:57:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)\
**Post date:** [January 20, 2023, 7:20pm UTC](https://forum.makecode.com/t/any-help-or-guidance-in-making-my-own-code-blocks-for-a-motor-hat/17477/2 "2023-01-20T19:20:17Z")

</div>

Hi @senorlloyd ,

That sounds like a great project!

I’ve created an example of new blocks. I’m not sure if it does what you want or need, but it might help you with the next step. I don’t have a Motor hat to do any testing, so this was partly some guess work based on your example. Also, your original example used P1 for speed for both motors. I guessed you may have meant P1 and P2. If not, my example will need some minor modification.

Here’s the example: [https://makecode.microbit.org/\_Hf36tx3ro1LY](https://makecode.microbit.org/_Hf36tx3ro1LY)

If it’s not quite what you want, you can modify the new blocks:

1. Click on the `JavaScript` slider at the top.
2. Below the simulated micro:bit is the word “Explorer” on a button with a down arrow. Click on the arrow, which will reveal all the files in the project.
3. The code and definitions for the new blocks are in the `custom.ts` file. You can update the code as needed (and the icon, toolbox color, etc.)
4. If you want to use different styles of blocks, you may want to explore the block creation Playground at [https://makecode.com/playground](https://makecode.com/playground) . You can select the micro:bit and editor the select several examples to browse and modify. I think most examples show their blocks in the toolbox with the puzzlepiece icon.

Once you’re happy with the blocks you can either use the Share Project link to allow your kids to each open their own version (open the link and then edit it). Or you can share the blocks via GitHub.

A few resources that you may find helpful:

- Publishing an extension via GitHub: [https://makecode.com/extensions/getting-started](https://makecode.com/extensions/getting-started)  
[https://makecode.com/extensions/getting-started/simple-extension](https://makecode.com/extensions/getting-started/simple-extension)
- Video of GitHub for extensions: [https://www.youtube.com/watch?v=ztrm4XehfGo](https://www.youtube.com/watch?v=ztrm4XehfGo)
- Video Deep Dive on creating extensions: [https://www.youtube.com/watch?v=Ku\_nHstZS64](https://www.youtube.com/watch?v=Ku_nHstZS64)

Hope that helps & good luck!  
Bill

P.S. If things work out, please share some examples of the projects somehow

---

_[View the full topic](https://forum.makecode.com/t/any-help-or-guidance-in-making-my-own-code-blocks-for-a-motor-hat/17477)._
