コード例 #1
0
ファイル: ImuComponent.cs プロジェクト: beaglebot/BeagleBot
        public override bool OnConnecting()
        {
            try
            {
                // Put HMC5883L into continuous measurement mode.
                I2CBus.Set(CompassI2CAddress, CompassRegisters.Mode, 0);
                AddPoll(1000, CompassI2CAddress, CompassRegisters.DataXMsb, 6);
            }
            catch (I2CException e) { return(false); }

            return(true);
        }
コード例 #2
0
 /// <summary>
 /// Writes a value to an I2C register on the target system.
 /// </summary>
 /// <param name="register"></param>
 /// <param name="value"></param>
 /// <exception cref="I2CException">Thrown if the write fails on the target system, or the network connection fails.</exception>
 /// <returns></returns>
 protected void SetI2CRegister(byte register, byte value)
 {
     I2CBus.Set(I2CAddress, register, value);
 }