Skip to content

added function #1

@Bernd54Albrecht

Description

@Bernd54Albrecht

added 3 functions to the module:
def get_y_rotation(self,x,y,z):
radians = math.atan2(x, math.sqrt((yy)+(zz)))
return -math.degrees(radians)

def get_x_rotation(self,x,y,z):
    radians = math.atan2(y, math.sqrt((x*x)+(z*z)))
    return math.degrees(radians)

def get_z_rotation(self,x,y,z):
    radians = math.atan2(z, math.sqrt((x*x)+(y*y)))
    return math.degrees(radians)

and 3 lines to the sample:
print(mpu.get_x_rotation(accel[0],accel[1],accel[2]))
print(mpu.get_y_rotation(accel[0],accel[1],accel[2]))
print(mpu.get_z_rotation(accel[0],accel[1],accel[2]))

any idea, how to calibrate the sensor? Greetings Bernd54Albrecht@gmail.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions