Guide by Michael; PiicoDev 3-Axis Accelerometer LIS3DH - Getting Started Guide

I have just shared content in Guides > PiicoDev: “PiicoDev 3-Axis Accelerometer LIS3DH - Getting Started Guide”





Read more

6 Likes

Loving the new unified guide format to match the unified python libraries. Super handy if you might be prototyping on one device before switching to another.

2 Likes

Hi @Michael
A suggestion for the shake demo code to make the output more ‘visible’

The original loop

while True:
    if motion.shake(threshold=15):
        print("shaken!")
    else:
        print("")
    # shake() is blocking, so can be used instead of sleep_ms() to delay a loop.

my updated loop

while True:
    if motion.shake(threshold=15):
        print("shaken!")
    else:
        print(".", end="")
    # shake() is blocking, so can be used instead of sleep_ms() to delay a loop.

and some sample output

...............shaken!
.......shaken!
.........shaken!
....................................shaken!
..shaken!

cheers
Murray

p.s. been playing with new toys from the Borg article credit note - thanks

4 Likes

Hi Murray,

It’s not the conventional scroll most people are used to seeing from a terminal window, but I like it!
I’ll probably use your format in my own projects even if it doesn’t become the PiicoDev example standard.
Glad to hear there’s already a new project in the works after the Borg cube, keen to see what you make next.

2 Likes

Hi Trent,

I added that bit because with the scrolling, and practicing to get the right amount of ‘shake’ I wasn’t sure what was happening. Fast scrolling ‘blank’ lines and trying to catch a activity message drove me slightly bats…t :bat: I don’t mind seeing ‘null report’ mesages - it at least lets me know that the process is doing something!

Murray

2 Likes

Hi, I had some questions regarding the code in the PiicoDev 3-Axis Accelerometer LIS3DH - Getting Started Guide.

We are using a Raspberry Pi Pico and for some reason whenever we try to run the acceleration function the serial connection gets interrupted for some reason and it returns that the connection is taken.

Does anyone have any advice on how to troubleshoot this? Thanks!

2 Likes

Hey @Kyden271126,

Would you be able to link us to the code you are running for this as well as the exact error message you are getting?

I see you have followed the above tutorial, have you copied the code example exactly or have you made some modifications for your specific project?

Thanks,
Sam

2 Likes

1 Like

Hi Kyden,

When I’ve typically seen this error with other microcontrollers it usually meant the device was in use. This may not be the case here.

I can see there is quite a bit of code there so it would be great if you could upload that for us to have a look at,

1 Like

Hi Kyden,

It looks like you may have also selected the Pyboard in tools instead of the Pico

1 Like