# Meowbit z value inverted in MakeCode

**URL:** <https://forum.makecode.com/t/meowbit-z-value-inverted-in-makecode/453>\
**Category:** Arcade\
**Created:** [August 17, 2019, 6:17pm UTC](https://forum.makecode.com/t/meowbit-z-value-inverted-in-makecode/453 "2019-08-17T18:17:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjw](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kjw](https://forum.makecode.com/u/kjw)\
**Post date:** [August 17, 2019, 6:17pm UTC](https://forum.makecode.com/t/meowbit-z-value-inverted-in-makecode/453/1 "2019-08-17T18:17:31Z")

</div>

The Meowbit’s z value is _inverted_ in MakeCode Arcade Programs. If the device is lying flat (has to be supported as the battery bulge means it doesn’t want to) then the z value for mine is 1067. I would expect around -1000 (note negative) to match the simulator _and_ the PyGamer. This is on `0.13.22 5.19.9`. Where does the fault lie here? Does the bootloader have any influence on this?

On a more trivial note, the `acceleration (mg)` block says:

> Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1023)

If these are mg then I would expect that to read `z=-1000` for standard gravity? -1023 looks more like a value inspired by an irrelevant, symmetric range limitation on an 11bit signed integer?

I’ve been using this simple code to check the values:

![arcade-Accelerometer-Check-v1](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/c0ee5ac3214fe977431304c7455ef754207d56e3.png)

I’m using @AlexK’s very useful `pxt-arcade-display-strings` extension in there, thanks for that.

Would be great to get to get [GH: microsoft/pxt-arcade: Simulator tilt is visually incorrect in MakeCode Arcade Beta. #1211](https://github.com/microsoft/pxt-arcade/issues/1211) fixed too. That’s very confusing.

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [August 17, 2019, 11:59pm UTC](https://forum.makecode.com/t/meowbit-z-value-inverted-in-makecode/453/2 "2019-08-17T23:59:33Z")

</div>

We currently don’t have a bootloader config key for this but we should. The Z should be easy since the accelerometer chip is on the back of all boards we have so far.

Will take a look on Monday.

---

<div class="post-metadata">

**Author:** ![kjw](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kjw](https://forum.makecode.com/u/kjw)\
**Post date:** [August 19, 2019, 5:38pm UTC](https://forum.makecode.com/t/meowbit-z-value-inverted-in-makecode/453/3 "2019-08-19T17:38:51Z")

</div>

What is the significance of a “bootloader config key”?

I’ve also noticed the on blocks for accelerometer don’t work on the Meowbit: [GH: microsoft/pxt-arcade Accelerometer event blocks from controller extension on Meowbit do not work #1216](https://github.com/microsoft/pxt-arcade/issues/1216)

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [August 19, 2019, 6:09pm UTC](https://forum.makecode.com/t/meowbit-z-value-inverted-in-makecode/453/4 "2019-08-19T18:09:31Z")

</div>

Technical details about bootloader config are here: [https://github.com/microsoft/uf2/blob/master/cf2.md](https://github.com/microsoft/uf2/blob/master/cf2.md)

Essentially, the bootloader contains configuration data for the MakeCode runtime (and possibly other runtimes). We don’t actually use any code from the bootloader when the application is running, so it’s not exactly drivers.

Anyways, the runtime currently doesn’t allow changing of the accelerometer reference frame, based on bootloader config keys but we should, and will, add it.
