Trying to accessing accelerometer values on sipy with pytracks
-
Hey everyone,
I am trying to use some example code i found to find the accelerometer values on the pytracks. The error reads "File "<stdin>", line 9, in <module> TypeError: function does not take keyword arguments "
I am new to python and am not sure whether the i2c=i2c is correct syntax or if somthing is wrong with the LIS2HH12 library? I also have not updated the pytracks to the latest version but have updated the sipy.
Any help would be appreciated,
Thanks
-
@bucknall : @chrisi runned into one of your documentation errors: https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/pytrack-examples.html#axis-accelerometer
you might adapt the example as mentioned above.
-
Thanks @this-wiederkehr and @thoppe got it to work using the change
acc = LIS2HH12()
-
@thoppe said in Trying to accessing accelerometer values on sipy with pytracks:
LIS2HH12
When instatiating LIS2HH12 there is no keyword parameter i2c.
see the __init__method of the class:
def __init__(self, pysense = None, sda = 'P22', scl = 'P21'):
File found here:
https://github.com/pycom/pycom-libraries/blob/master/pytrack/lib/LIS2HH12.pyYou might try to instantiate without any parameters like so (change line 8 to):
acc = LIS2HH12()
-
@chrisi sorry, misread your post. I thought it was pysense you were using and wanting to deepsleep. Now looking at it, I cannot see anything glaringly wrong. I have used similar code to get accelerometer to read correctly on SiPy & PySense board.
-
You have not included the pysense.py file, place it in lib folder.
from pysense import Pysense #import the file
py = Pysense() #instanciate the object
acc = LIS2HH12(i2c=i2c)
.......