LIS3DH + Trinket M0 + MakeCode

Microsoft's MakeCode platform for easy blocks-style programming

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
_david_f
 
Posts: 11
Joined: Sun Aug 14, 2022 12:05 pm

LIS3DH + Trinket M0 + MakeCode

Post by _david_f »

Hi there,

I would love to use the acceleration extension in MakeCode (https://maker.makecode.com/) with a Trinket M0.
It is connected to the SDA and SCL pins of the controller, but not working out of the box.
Is there anything I can do to make this work?

Cheers, David

User avatar
rooppoorali
 
Posts: 98
Joined: Sat Jul 16, 2022 12:04 pm

Re: LIS3DH + Trinket M0 + MakeCode

Post by rooppoorali »


User avatar
_david_f
 
Posts: 11
Joined: Sun Aug 14, 2022 12:05 pm

Re: LIS3DH + Trinket M0 + MakeCode

Post by _david_f »

Hi rooppoorali,

well, I hooked up the LIS3DH https://www.adafruit.com/product/2809 to the I2C pins of the Trinket M0 (D0 = SDA, D2 = SCL, 3.3V = VIN , GND = GND) and did the quick test file you see in the screenshot.
In the simulator it works, but not on the Trinket.

Best, David
Attachments
Trinket Accelerator.png
Trinket Accelerator.png (26.26 KiB) Viewed 1059 times

User avatar
_david_f
 
Posts: 11
Joined: Sun Aug 14, 2022 12:05 pm

Re: LIS3DH + Trinket M0 + MakeCode

Post by _david_f »

I also made sure the device is working, using the Arduino IDE and the Adafruit LIS3DHlibrary.

User avatar
_david_f
 
Posts: 11
Joined: Sun Aug 14, 2022 12:05 pm

Re: LIS3DH + Trinket M0 + MakeCode

Post by _david_f »

Maybe I should add, that I get the reading "0" for acceleration and rotation (all axis) in MakeCode.

User avatar
_david_f
 
Posts: 11
Joined: Sun Aug 14, 2022 12:05 pm

Re: LIS3DH + Trinket M0 + MakeCode

Post by _david_f »

So, I went through “accelhw.cpp” and found that it should just work, if there are sda and scl pins with a LIS3DH connected. Nevertheless I tried to set the right variables in the config.

In “main.ts” I wrote:

namespace config{
export const ACCELEROMETER_TYPE = DAL.ACCELEROMETER_TYPE_LIS3DH_ALT;
export const PIN_ACCELEROMETER_SDA = DAL.PA08;
export const PIN_ACCELEROMETER_SCL = DAL.PA09;
export const PIN_ACCELEROMETER_INT = DAL.PA02;
}
Now the binary.asm says:

.word 1, 2 ; PIN_ACCELEROMETER_INT=2
.word 2, 9 ; PIN_ACCELEROMETER_SCL=9
.word 3, 8 ; PIN_ACCELEROMETER_SDA=8
...
.word 70, 48 ; ACCELEROMETER_TYPE=48

But now the Trinket hangs completely and I even don’t get the 0 reading.
Is there a way to debug this?

Locked
Please be positive and constructive with your questions and comments.

Return to “MakeCode”