Microsoft MakeCode

Accelerometer (LIS3DH) reading in console

I was trying to display my I2C acelerometer (x) value on the console using Meowbit.
It works fine in the simulator (https://arcade.makecode.com/beta#editor) but the code
won’t compile so I cannot download the uf2 file.

arcade-test_accel

What am I missing here?

In beta beta I get a Compilated failed, please check your code for errors for Meowbit target. Is that what you get?

The first one took a long time, maybe a minute to appear. It then becomes near-instant if I hit Download again. built/output.txt isn’t helpful, it says, Everything sems fine!. I switched board to the PyGamer target. It took a long time again but did work, downloaded ok to the device and tests fine.

For me it appears not to like the Meowbit.

Here’s what I found:
It did not compile with Makecode Arcade BETA but it worked just fine with Makecode Arcade.

Hm, thanks for pointing this out, filed here: https://github.com/microsoft/pxt-arcade/issues/1406

Referencing a similar post below:
https://forum.makecode.com/t/re-d51-sound-mixer/735

But my LIS3DH has a default address at 0x18.

Does that mean I have to set the config to this value when compiling the bootloader?

1, 0x36, // PIN_ACCELEROMETER_INT = PB22
2, 0xd, // PIN_ACCELEROMETER_SCL = PA13
3, 0xc, // PIN_ACCELEROMETER_SDA = PA12
70, 0x18, // ACCELEROMETER_TYPE = LIS3DH

How do I set/change the LIS3DH address on the patcher?

There is a bit of confusion around i2c addresses being 7 or 8 bit. 0x18<<1==0x30 so I suspect you need 0x30. 0x18 will not work.

Thank you @mmoskal.
I used LIS3DH_ALT on the patcher and it worked like a charm. :hugs: