Atmel AVR4016
Scaled rotation rate measurements are expressed in degrees per second. When the
function returns, the values can be read from the gyro_data structure using the “axis”
fields ( axis.x, axis.y, axis.z ).
7.4.1 Example code sequence
7.4.1.1 Definitions and declarations
#include "sensor.h"
sensor_t
sensor_data_t
gyro_dev;
gyro_data;
// device descriptor
// rotation data from device
7.4.1.2 Sensor initialization
sensor_attach (&gyro_dev, SENSOR_TYPE_GYROSCOPE, 0, 0);
7.4.1.3 Sensor read
gyro_data.scaled = true;
// read values in degrees per second
sensor_get_rotation (&gyro_dev, &gyro_data);
7.4.1.4 Use data in application
int32_t
int32_t
int32_t
app_x_value
app_y_value
app_z_value
= gyro_data.axis.x;
= gyro_data.axis.y;
= gyro_data.axis.z;
uint32_t app_read_time = gyro_data.timestamp;
7.5 Compass heading
The most common use of a magnetic compass sensor is to obtain a direction heading
relative to magnetic north for use in orientation and navigation applications. The
Atmel Sensors Xplained API provides the sensor_get_heading() function to read
the device and calculate such a heading value. The function takes the following form:
sensor_get_heading (&device, &compass_data);
where device is the device descriptor of the compass and compass_data is a
sensor_data_t structure to receive the heading data.
The function returns three data values within the sensor_data_t structure using the
"heading" fields:
The first value is the direction value, expressed in degrees (0 to 360, clockwise) from
magnetic north. The direction value is the angle between the positive Y-axis of the
device and the measured horizontal direction of the magnetic vector. The value can
be read from the compass_data.heading.direction field.
The second value is the inclination angle expressed in degrees (-90 to +90) relative to
horizontal. The inclination notation follows conventional usage in which positive
values indication a downward (into the earth) angle and negative values indicate an
upward angle. The inclination value can be read from the
compass_data.heading.inclination field.
The third value is the net magnetic field strength (intensity) expressed in microteslas
(μT). The value can be read from the compass_data.heading.strength field. This is
a single net field strength value – to obtain separate readings of the field strength for
17
8367B-AVR-06/11
相关PDF资料
ATAVRSBIN2 INERTIAL TWO SENSOR BOARD
ATAVRSBLP1 LIGHT AND PROXIMITY SENSOR BOARD
ATAVRSBPR1 BAROMETRIC PRESSURE ONE SNSR BRD
ATQT600 KIT EVAL TOUCH FOR QT600
ATU6-P305T-R CABLE CAT6 FULL-BOX 305M GRAY
ATUP-P305T-R CABLE CAT5E PULL-BOX 305M GRAY
ATUP-V305T-R CABLE CAT5E REEL 305M GRAY
AWG28-05/F-1/300-R CABLE 5 COND MULTI 300' RIBBON
相关代理商/技术参数
ATAVRSBIN2 功能描述:多功能传感器开发工具 9DOF Inertial Sensor Board 2 RoHS:否 制造商:Texas Instruments 工具用于评估:LMP91200 接口类型:SPI 工作电压:1.8 V to 5.5 V 最大工作温度:
ATAVRSBLP1 功能描述:光学传感器开发工具 Ambient Light and Proximity Snsr Brd RoHS:否 制造商:ams 工具用于评估: 接口类型: 最大工作温度:
ATAVRSBPR1 功能描述:压力传感器开发工具 Barometric Pressure Sensor Board 1 RoHS:否 制造商:Freescale Semiconductor 工具用于评估:MPL3115A2 接口类型:USB 最大工作温度:
ATAVRSECURITYX 功能描述:安全/ 验证开发工具 Security Module Kit for Xplain Series RoHS:否 制造商:Digi International 产品:Development Kits 工具用于评估:XEB-AW140 接口类型:SPI, USB 工作电源电压:3.1 V to 3.6 V
ATAVRSMD 功能描述:ADAPTER KIT SMD ICE200 RoHS:否 类别:编程器,开发系统 >> 过时/停产零件编号 系列:- 标准包装:1 系列:- 类型:MCU 适用于相关产品:Freescale MC68HC908LJ/LK(80-QFP ZIF 插口) 所含物品:面板、缆线、软件、数据表和用户手册 其它名称:520-1035
ATAVR-SOAKIT 功能描述:插座和适配器 Standoff Adapter Kit for JTAG debuggers RoHS:否 制造商:Silicon Labs 产品:Adapter 用于:EM35x
ATAVRTEMPSENSORX 功能描述:温度传感器开发工具 Temp Sensor kit for Xplain Series RoHS:否 制造商:Texas Instruments 产品类型:Temperature Sensors and Control ICs 工具用于评估:MSP430G2553 接口类型:USB 工作电源电压: 工作电源电流:
ATAVRTS2080A 功能描述:开发板和工具包 - AVR ATmega88 QTouch QTch kit w/SW librar RoHS:否 制造商:Arduino 产品:Evaluation Boards 工具用于评估:ATMega32U4 核心:AVR 接口类型:I2C, UART, USB 工作电源电压:6 V to 20 V