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
LIS3DH + Trinket M0 + MakeCode
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- rooppoorali
- Posts: 98
- Joined: Sat Jul 16, 2022 12:04 pm
Re: LIS3DH + Trinket M0 + MakeCode
Hi, have you followed the following documents?
https://learn.adafruit.com/adafruit-lis ... cuitpython
https://learn.adafruit.com/adafruit-tri ... o/makecode
https://learn.adafruit.com/adafruit-lis ... cuitpython
https://learn.adafruit.com/adafruit-tri ... o/makecode
- _david_f
- Posts: 11
- Joined: Sun Aug 14, 2022 12:05 pm
Re: LIS3DH + Trinket M0 + MakeCode
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
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 (26.26 KiB) Viewed 1096 times
- _david_f
- Posts: 11
- Joined: Sun Aug 14, 2022 12:05 pm
Re: LIS3DH + Trinket M0 + MakeCode
I also made sure the device is working, using the Arduino IDE and the Adafruit LIS3DHlibrary.
- _david_f
- Posts: 11
- Joined: Sun Aug 14, 2022 12:05 pm
Re: LIS3DH + Trinket M0 + MakeCode
Maybe I should add, that I get the reading "0" for acceleration and rotation (all axis) in MakeCode.
- _david_f
- Posts: 11
- Joined: Sun Aug 14, 2022 12:05 pm
Re: LIS3DH + Trinket M0 + MakeCode
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?
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?
Please be positive and constructive with your questions and comments.