Esempio n. 1
0
        public void CanBuildInstructionForSensorData()
        {
            ISender sender = new FakeSender();
            var corectResult = new byte[] { 0XFF, 0XFF, 0X01, 0X04, 0X02, 0X24, 0X08, 0XCC };
            InstructionPacketBase instructionPacket = new InstructionPacketReadServoSensorData(SERVO_ID, sender);

            Assert.AreEqual(0xFF, instructionPacket.StartByte1);
            Assert.AreEqual(0xFF, instructionPacket.StartByte2);
            Assert.AreEqual(0x01, instructionPacket.ServoId);
            Assert.AreEqual(0x04, instructionPacket.LengthOfCommand);
            Assert.AreEqual(0x02, instructionPacket.Instruction);
            Assert.AreEqual(0xCC, instructionPacket.CheckSum);
            Assert.AreEqual(corectResult, instructionPacket.ToByte());
        }
Esempio n. 2
0
        public void LiveSensorTest()
        {
            CommunicationObject communicationObject = new CommunicationObject("COM4");
            //communicationObject.Respons

            while (true)
            {
                var instructionPacket = new InstructionPacketReadServoSensorData(5, communicationObject);
                instructionPacket.Send();
                Thread.Sleep(2000);
            }

            ((CommunicationObject)communicationObject).Dispose();
        }