Sub Process_Globals
Public Serial1 As Serial
Private mpu As MPU6050_I2C
Private Timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
'Init the MPU first via SoftI2C with low address 0x68
mpu.InitializeSoftI2C(mpu.ADDRESS_AD0_LOW,0,0,0)
'Init the timer
Timer1.Initialize("Timer1_Tick", 1000)
Timer1.Enabled = True
End Sub
Sub Timer1_Tick
'Temperature in deg C
Dim t As Double = mpu.GetTemp10th / 10
Log("T degC=", t)
'Acceleration in g (1g = 9.8 m/s/s)"
mpu.GetAccelRaw
Log("A in g :: X=", mpu.Accel_X_Raw, ",Y=", mpu.Accel_Y_Raw, ",Z=", mpu.Accel_Z_Raw)
'Gyro angular velocity in degrees / second")
mpu.GetGyroRaw
Log("G deg/s :: X=", mpu.Gyro_X_Raw, ",Y=", mpu.Gyro_Y_Raw, ",Z=", mpu.Gyro_Z_Raw)
End Sub