AbsoluteIM (compass) rigisters access problem
 NXT and EV3   Started by Alexander Erokhin   2017-10-15 06:14:17 -04:00   Comments: 2    Viewed: 97

  1. Hello All! 

    Please, can I ask you to help me to find a problem. When I am trying to read
    "Compass heading LSB" at "0x4B" small basic method return 75 (decimal of 0X4B)

    e.g.:
    _CompassValue = Sensor.ReadI2CRegister("1",34,75) 

    in the case of calling ("0X4B" instead of decimal 75) 
    _CompassValue = Sensor.ReadI2CRegister("1",34,"0X4B")

    method returns 0.

    Thanks an advance!:)
     

    Alexander Erokhin, 2017-10-15 06:14:17 -04:00
  2. What is wrong here?
    переводчик — Яндекс: нашлось 127 млн результатов
     
    Unfortunately I found no any information, code examples, or smth to help:(



    'Attempt to get something from sensor...
    _AbsoluteIMU_EV3_Port_Number = "3"
    _AbsoluteIMU_I2C_Adress = 34 'dec of 0x22
    _AbsoluteIMURegister_0x42 = 66 'dec of 0x42
    _SensorValue = -1 ' to store value from sensor, set to -1 to be sure that value will be changed after method call

    For i = 0 To 10
    _SensorValue = Sensor.ReadI2CRegister(_AbsoluteIMU_EV3_Port_Number,34,_AbsoluteIMURegister_0x42+i)
    TextWindow.WriteLine("_SensorValue" +"[" + i + "]=" + _SensorValue)
    Program.Delay(300)
    EndFor

    What I see:
    _SensorValue[0]=66
    _SensorValue[1]=67
    _SensorValue[2]=68
    _SensorValue[3]=69
    _SensorValue[4]=70
    _SensorValue[5]=71
    _SensorValue[6]=72
    _SensorValue[7]=73
    _SensorValue[8]=74
    _SensorValue[9]=75
    _SensorValue[10]=76


    Alexander Erokhin, 2017-10-16 14:38:46 -04:00
  3. (You must log in or sign up to post here)

Log in | Sign up
Tems & Conditions!
Help!