public void ItCanConnect()
        {
            var comm       = new BluetoothCommunication("COM4");
            var controller = new BrickController(comm);

            controller.Connect();
        }
Exemple #2
0
        public async Task ItCanConnect()
        {
            var comm       = new MockCommunication();
            var controller = new BrickController(comm);
            await controller.Connect();

            Assert.AreEqual(1, comm.ReceivedData.Count);
        }
        public async Task ItCanTurnMotor()
        {
            var comm       = new BluetoothCommunication("COM4");
            var controller = new BrickController(comm);

            controller.Connect();

            await controller.TurnMotorAsync(OutputPort.C, 50, 1);
        }
Exemple #4
0
        public async Task ItCanTurnMotor()
        {
            var comm       = new MockCommunication();
            var controller = new BrickController(comm);
            await controller.Connect();

            await controller.TurnMotorAsync(OutputPort.A, 50, 1);

            Assert.AreEqual(2, comm.ReceivedData.Count);
        }
        public void ItCanSendTankCommands()
        {
            var comm       = new BluetoothCommunication("COM4");
            var controller = new BrickController(comm);

            Console.WriteLine("Connecting...");
            controller.Connect();

            controller.TankMove(50, 50, 2);
            controller.TankMove(50, -50, 2);
            controller.TankMove(-50, -50, 2);
        }
Exemple #6
0
        public async Task ItCanSendTankCommands()
        {
            var comm       = new MockCommunication();
            var controller = new BrickController(comm);

            Console.WriteLine("Connecting...");
            await controller.Connect();

            Console.WriteLine("Tank Move...");
            controller.TankMove(50, 50, 1);
            controller.TankMove(-50, -50, 1);
        }
Exemple #7
0
        async void Button_OnClicked(object sender, EventArgs e)
        {
            var comm = DependencyService.Get <IXamarinCommunication>();

            var devices = await comm.GetDeviceList();

            var selection = await DisplayActionSheet("Select Bluetooth Device", "Cancel",
                                                     null, devices);

            comm.SelectDevice(selection);
            _controller = new BrickController(comm);
            await _controller.Connect();
        }
Exemple #8
0
        static void Main()
        {
            var comm       = new BluetoothCommunication("COM4");
            var controller = new BrickController(comm);

            Task.Run(async() =>
            {
                await controller.Connect();

                for (var i = 0; i < 100; i++)
                {
                    while (controller.UltrasonicRange > 10)
                    {
                        Console.WriteLine(controller.UltrasonicRange);
                        controller.TankMove(50, 50, 0.5);
                    }

                    controller.TankMove(50, -50, 1);
                }
            });
        }