Arduino Toolkit - mpu6050
Methods
- :
obj =
mpu6050(arObj) - :
obj =
mpu6050(arObj,propertyname, propertyvalue ....)
Constructor to create MPU-6050 sensor
Inputs
arObj - the arduino parent object
propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:
- I2CAddress
I2C address of the sensor (default 0x40)
- Bus
I2C bus - 0 or 1 (default 0)
Outputs
obj - created object
Example
a = arduino() sensor = mpu6050(a)
- :
[C, timestamp] =
readTemperature(obj) Read the temperature
Inputs
obj - the sensor object
Outputs
C - read temperature in deg C.
timestamp - timestamp when read
Example
a = arduino() s = mpu6050(a) # get temp temp = s.readTemperature
See also: mpu6050.
- :
[readVal, timestamp] =
readAcceleration(obj) Read the acceleration rate
Inputs
obj - the sensor object
Outputs
readVal - the 3 acceleration values
timestamp - timestamp when read
- :
[readVal, timestamp] =
readAngularVelocity(obj) Read the angular velocity
Inputs
obj - the sensor object
Outputs
readVal - the 3 angular velocity values
timestamp - timestamp when read
- :
[readings, overrun] =
read(obj) - :
[accel, gyro, mag, timestamp, overrun] =
read(obj) Read the sensor data
Inputs
obj - the sensor object
Outputs
accel - acceleration reading from sensor.
gyro - angular acceleration reading from sensor.
timestamp - timestamp when read
overrun - overrun flag.
readings - table structure with fields for Timestamp, Acceleration, AngularVelocity.
- :
inf =
info(obj) Read the sensor info
Inputs
obj - the sensor object
Outputs
inf - structure containing the sensor information.
Structure fields are:
- SensorId
sensor id value
- Type
sensor type ’mpu6050’