Hi to all.
I have installed latest MiicroPython in STM32F411E-DISCO board.
Are there classes for handle giroscope and/or accelerometer ?
I trayed
>>> dir(machine) and dir(pyb)
but I don't saw any class 'giro' and/or 'accel'.
Someone can help me ?
Thanks
[STM32F411E-DISCO] Giroscope and accelerometer in STM32F411E-DISCO
-
- Posts: 34
- Joined: Wed Aug 08, 2018 9:15 am
Re: [STM32F411E-DISCO] Giroscope and accelerometer in STM32F411E-DISCO
The only mention of gyro is for the zephyrales.coppelli wrote:Hi to all.
I have installed latest MiicroPython in STM32F411E-DISCO board.
Are there classes for handle giroscope and/or accelerometer ?
I trayed
>>> dir(machine) and dir(pyb)
but I don't saw any class 'giro' and/or 'accel'.
Someone can help me ?
Thanks
https://github.com/micropython/micropyt ... gyro&type=
Is that your hw module?
Sent from my iPhone using Tapatalk Pro
-
- Posts: 34
- Joined: Wed Aug 08, 2018 9:15 am
Re: [STM32F411E-DISCO] Giroscope and accelerometer in STM32F411E-DISCO
Thank you for your answer. No, my hardware is different ( STM32F411-DISCO ). I found in "ports/stm/boards/STM32F4DISCO" the class
STAccel and I put it in 'boot.py' file. When I try
>>> a = STAccell()
I obtain
Traceback error:
Exception: LIS302DL or LIS3DSH accelerometer not present
and... is correct because this sensor is in STM32F4-DISCO but not in STM32F411-DISCO ( in this board there is LSM303DLHC (U5) chip).
Anyone know how to modify the 'STAccel' class for this different accelorometer chip ?
STAccel and I put it in 'boot.py' file. When I try
>>> a = STAccell()
I obtain
Traceback error:
Exception: LIS302DL or LIS3DSH accelerometer not present
and... is correct because this sensor is in STM32F4-DISCO but not in STM32F411-DISCO ( in this board there is LSM303DLHC (U5) chip).
Anyone know how to modify the 'STAccel' class for this different accelorometer chip ?
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: [STM32F411E-DISCO] Giroscope and accelerometer in STM32F411E-DISCO
When I tested the staccel.py module on an STM32F4 Discovery module, I had to modify it slightly to make it work, because reading the chip ID via SPI would always fail on the first try. I don't know if that's still the case with an up-to-date MicroPthon version. Here's my version:
https://github.com/SpotlightKid/micropy ... ster/accel
To support a new chip, you could start by adding to the initialization code in the init method around line 58. If the LSM303DLHC is similar to the already supported chips you may only need to set the chip configuration and the sensitivity.
https://github.com/SpotlightKid/micropy ... ster/accel
To support a new chip, you could start by adding to the initialization code in the init method around line 58. If the LSM303DLHC is similar to the already supported chips you may only need to set the chip configuration and the sensitivity.
-
- Posts: 34
- Joined: Wed Aug 08, 2018 9:15 am
Re: [STM32F411E-DISCO] Giroscope and accelerometer in STM32F411E-DISCO
Thanks, I'll try it.