Good night. I have a LIS2DH12TR over an ATSAML21E17B. I´m reading the values of axis (x,y,x) transforming the values to degres (from -90º to 90º) but I need degrees from 0 to 360. I have tested a lot of formulas but nothing. Any idea? Ty.
This is the configuration of accelerometer:
// Enable Block Data Update
lis2dh12_block_data_update_set(&dev_ctx, PROPERTY_DISABLE);
// Set Output Data Rate
lis2dh12_data_rate_set(&dev_ctx, LIS2DH12_ODR_100Hz);
// Set full scale
lis2dh12_full_scale_set(&dev_ctx, LIS2DH12_2g);
// Enable temperature sensor
lis2dh12_temperature_meas_set(&dev_ctx, LIS2DH12_TEMP_DISABLE);
// Set device in continuous mode
lis2dh12_operating_mode_set(&dev_ctx, LIS2DH12_HR_12bit);
// Enable and configure high-pass filter
lis2dh12_high_pass_mode_set(&dev_ctx, LIS2DH12_NORMAL_WITH_RST);
lis2dh12_high_pass_bandwidth_set(&dev_ctx, LIS2DH12_AGGRESSIVE);
lis2dh12_high_pass_on_outputs_set(&dev_ctx, 0);
lis2dh12_high_pass_int_conf_set(&dev_ctx, LIS2DH12_ON_INT1_GEN);
// Reset filter
uint8_t filterRef;
lis2dh12_filter_reference_get(&dev_ctx, &filterRef);
// Configure interrupts
lis2dh12_ctrl_reg6_t int_polarity = {0};
int_polarity.int_polarity = 0; // 0: active-high; 1: active-low
lis2dh12_pin_int2_config_set(&dev_ctx, &int_polarity);I ´m using this formulas (i obtein degrees from -90 to 90):
result_x = 57.2957786 * (atan2( accel_values.x,sqrt(accel_values.y * accel_values.y + accel_values.z * accel_values.z)));
result_y = 57.2957786 * (atan2( accel_values.y,sqrt(accel_values.x * accel_values.x + accel_values.z * accel_values.z)));Someone could help me or say what is the way to transform the values to degrees 360º?
Thank you.
