public async Task turnAround()
        {
            //await Task.Delay(100);
            //float currentAngle = GyroSensor.getSIValue();

            //while (gyroSensor.getSIValue() >= currentAngle - 360)
            //{
            //    MainBrick.Brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.A, -27, 10, false);
            //    MainBrick.Brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.D, 27, 10, false);
            //    await MainBrick.Brick.BatchCommand.SendCommandAsync();
            //    await Task.Delay(100);
            //}

            await Task.Delay(100);

            // store current angle
            float currentAngle = GyroSensor.getSIValue();

            while (gyroSensor.getSIValue() >= currentAngle - 360)
            {
                MainBrick.Brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.A, -30, 10, false);
                MainBrick.Brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.D, 30, 10, false);
                await MainBrick.Brick.BatchCommand.SendCommandAsync();

                await Task.Delay(10);
            }
        }
 public LegoBot()
 {
     mainBrick        = new MainBrick();
     gyroSensor       = new GyroSensor();
     ultrasonicSensor = new UltrasonicSensor();
     colourSensor     = new ColourSensor();
     motor            = new Motor();
 }
        public async Task stepMotor()
        {
            await Task.Delay(100);

            // store current angle
            float currentAngle = GyroSensor.getSIValue();

            while (gyroSensor.getSIValue() >= currentAngle - 90)
            {
                MainBrick.Brick.BatchCommand.StepMotorAtPower(OutputPort.A, -25, 1, false);
                MainBrick.Brick.BatchCommand.StepMotorAtPower(OutputPort.D, 25, 1, false);
                await MainBrick.Brick.BatchCommand.SendCommandAsync();

                await Task.Delay(10);
            }
        }
        public async Task TurnLeft()
        {
            // delay it by few milli sec
            await Task.Delay(100);

            // store current angle
            float currentAngle = GyroSensor.getSIValue();

            while (gyroSensor.getSIValue() >= currentAngle - 90)
            {
                MainBrick.Brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.A, -25, 10, false);
                MainBrick.Brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.D, 25, 10, false);
                await MainBrick.Brick.BatchCommand.SendCommandAsync();

                await Task.Delay(10);
            }
        }